Giter Club home page Giter Club logo

shamsidatepicker's Introduction

ShamsiDatePicker

An easy-to-use SwiftUI iOS/watchOS date picker for Shamsi (Persian) calendar.

ShamsiDatePicker in iOS ShamsiDatePicker in iOS with Dark Mode

ShamsiDatePicker in Apple Watch ShamsiDatePicker in Apple Watch used in a `Form` view

Features

  • Pure (100%) SwiftUI implementation
  • Full support for Shamsi (Persian) calendar, including weekday names and leap years
  • Easy to customize various properties, such as minimum and maximum date allowed
  • Simple to use in various views by adding a single line of code
  • Support for both iOS (13.0 +) and watchOS (7.0 +) apps with great-looking styles
  • Compact style when used in watchOS Forms

Installation

ShamsiDatePicker can easily be installed using Swift Package Manager (SPM).

  1. Open your project in Xcode.
  2. Click File -> Swift Packages -> Add Package Dependency...
  3. Add https://github.com/spneshaei/ShamsiDatePicker.git as a package

Usage

Basic Usage

To 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)
    }
}

Setting a Range of Supported Dates

To specify the minimum and maximum possible-to-select dates from ShamsiDatePicker, you can specify those dates in ShamsiDatePickers initializer:

ShamsiDatePicker(selectedDate: $date, minDate: Date(timeIntervalSince1970: 0), maxDate: Date())

Using ShamsiDatePicker in SwiftUI Forms

ShamsiDatePicker works with SwiftUI Forms 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.

License

To see the license which is applied to all the files in the current repository, open LICENSE.

shamsidatepicker's People

Contributors

spneshaei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.