An easy-to-use SwiftUI iOS/watchOS date picker for Shamsi (Persian) calendar.
Form
sShamsiDatePicker
can easily be installed using Swift Package Manager (SPM).
File -> Swift Packages -> Add Package Dependency...
https://github.com/spneshaei/ShamsiDatePicker.git
as a packageTo use ShamsiDatePicker
in a SwiftUI view, you should import ShamsiDatePicker
first:
import ShamsiDatePicker
Then, you can start using ShamsiDatePicker
:
struct ContentView: View {
@State var date = Date()
var body: some View {
ShamsiDatePicker(selectedDate: $date)
}
}
To specify the minimum and maximum possible-to-select dates from ShamsiDatePicker
, you can specify those dates in ShamsiDatePicker
s initializer:
ShamsiDatePicker(selectedDate: $date, minDate: Date(timeIntervalSince1970: 0), maxDate: Date())
ShamsiDatePicker
in SwiftUI Form
sShamsiDatePicker
works with SwiftUI Form
s out of the box. When using ShamsiDatePicker
in watchOS, using ShamsiDatePicker
in a Form
will result in a compact date picker, suitable for the Apple Watch's small display. When you use ShamsiDatePicker
outside of the Form
view, ShamsiDatePicker
will be rendered as a wheel scrolling view, similar to its iOS counterpart.
To see the license which is applied to all the files in the current repository, open LICENSE
.
link |
Stars: 21 |
Last commit: 1 year ago |
Fixed a bug when adding the package to Xcode 13 failed due to watchOS support
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics