GithubHelp home page GithubHelp logo

nivritgupta / recurrencepicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alibaba-archive/recurrencepicker

0.0 0.0 0.0 2.94 MB

An event recurrence rule picker similar to iOS system calendar.

License: MIT License

Swift 98.14% Ruby 1.86%

recurrencepicker's Introduction

RecurrencePicker

An event recurrence rule picker similar to iOS system calendar.

Example

How To Get Started

Carthage

Specify "RecurrencePicker" in your Cartfile:

github "teambition/RecurrencePicker"

Usage

Import necessary frameworks

import RRuleSwift
import EventKit
import RecurrencePicker

Initialization and Configuration

// prepare a recurrence rule and an occurrence date
// occurrence date is the date which the repeat event occurs this time
let recurrenceRule = ...
let occurrenceDate = ...

// initialization and configuration
// RecurrencePicker can be initialized with a recurrence rule or nil, nil means "never repeat"
let recurrencePicker = RecurrencePicker(recurrenceRule: recurrenceRule)
recurrencePicker.language = .english
recurrencePicker.calendar = Calendar.current
recurrencePicker.tintColor = UIColor.blue
recurrencePicker.occurrenceDate = occurrenceDate

// assign delegate
recurrencePicker.delegate = self

// push to the picker scene
navigationController?.pushViewController(recurrencePicker, animated: true)

Implement the delegate

func recurrencePicker(_ picker: RecurrencePicker, didPickRecurrence recurrenceRule: RecurrenceRule?) {
    // do something, if recurrenceRule is nil, that means "never repeat".
}

Minimum Requirement

iOS 8.0

Dependency

RecurrencePicker's running requires RRuleSwift.

Localization

RecurrencePicker supports 5 languages: English, Simplified Chinese, Traditional Chinese, Korean, Japanese. You can set the language when initialization.

You can also get a localized rule text string like this:

let ruleString = "RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=MO;DTSTART=20160413T133011Z;BYDAY=TU,WE,FR"
let recurrenceRule = RecurrenceRule(rruleString: ruleString)
let language: RecurrencePickerLanguage = ...
let recurrenceRuleText = recurrenceRule?.toText(of: language, occurrenceDate: Date())
print(recurrenceRuleText)
// Event will occur every 2 weeks on Tuesday, Wednesday and Friday.
// 事件将每2周于星期二、星期三和星期五重复一次。
// 行程每2週的星期二、星期三和星期五重複一次。
// 2주마다 화요일, 수요일 및 금요일에 이벤트 반복
// 2週間ごとに、火曜日、水曜日と金曜日にあるイベントです。

Release Notes

License

RecurrencePicker is released under the MIT license. See LICENSE for details.

More Info

Have a question? Please open an issue!

recurrencepicker's People

Contributors

hongxinhope avatar suricforever 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.