Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SwiftUI wrapper for DurationPicker #5

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

GabRoyer
Copy link

@GabRoyer GabRoyer commented Feb 12, 2025

Description

Added a SwiftUI wrapper for DurationPicker called DurationPickerView. I added it under a new library since very rarely do UIKit users want to use a SwiftUI component (and vice-versa) if there is a component that works natively with their framework.

I've renamed Mode to Components as it better aligns with SwiftUI's DatePicker terminology. Though I thought "displayedComponents" would be a misnomer as it's a bit more than what's being display since changing, say, the Hour component in .hour mode also sets the minutes and seconds to 0.

Usage

See preview for usage example, but it behaves pretty much like any SwiftUI view. For example, one can simply use it as such:

DurationPickerView(
  $duration,
  components: components,
  hourInterval: hourInterval,
  minuteInterval: minuteInterval,
  secondInterval: secondInterval,
  minumumDuration: minimumDuration,
  maximumDuration: maximumDuration
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant