Latest 0.2.3
Homepage https://github.com/petalvlad/RecurrencePicker
License MIT
Platforms ios 10.0
Authors

Version
License
Platform

An event recurrence rule picker similar to iOS system calendar.

Example

Installation

RecurrencePicker is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'RecurrencePicker'

Usage

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".
}

RRule usage

Original RRule library is here https://github.com/teambition/RRuleSwift

In this Pod it was adopted to use it with https://github.com/seejohnrun/ice_cube on the server side.

Instead of

let ruleString = "RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=MO;DTSTART=20160413T133011Z;BYDAY=TU,WE,FR"

Now rrule string looks like this (DTSTART is on the new line and date value is separated by semicolon)

let ruleString = "RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=MO;BYDAY=TU,WE,FRnDTSTART:20160413T133011Z"

Also Russian language and formatting a rule to text form was changed.

Minimum Requirement

iOS 10.0

Localization

RecurrencePicker supports 6 languages: English, Russian, 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;BYDAY=TU,WE,FRnDTSTART:20160413T133011Z"
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주마다 화요일, 수요일 및 금요일에 이벤트 반복
// 2週間ごとに、火曜日、水曜日と金曜日にあるイベントです。

Author

Original version https://github.com/teambition/RecurrencePicker

License

RecurrencePicker is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RecurrencePicker",
    "version": "0.2.3",
    "summary": "An event recurrence rule picker similar to iOS system calendar.",
    "description": "An event recurrence rule picker similar to iOS system calendar.nnRecurrencePicker supports 6 languages: English, Russian, Simplified Chinese, Traditional Chinese, Korean, Japanese.",
    "homepage": "https://github.com/petalvlad/RecurrencePicker",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "[email protected]": "[email protected]"
    },
    "source": {
        "git": "https://github.com/petalvlad/RecurrencePicker.git",
        "tag": "0.2.3"
    },
    "platforms": {
        "ios": "10.0"
    },
    "swift_version": "4.2",
    "source_files": "RecurrencePicker/Classes/**/*",
    "resources": "RecurrencePicker/**/*.{png,xib,strings,lproj,js}",
    "resource_bundles": {
        "RecurrencePicker": [
            "RecurrencePicker/**/*.{png,xib,strings,lproj,js}"
        ]
    }
}

Pin It on Pinterest

Share This