Skip to content

Code need minor update to work with latest version of Swift #3

@rayx

Description

@rayx

FYI. I made the following change to RWMRuleScheduler.swift to build it on my system:

--- RWMRuleScheduler_old.swift      2019-12-07 22:09:57.000000000 +0800
+++ RWMRuleScheduler.swift      2019-12-07 22:54:54.000000000 +0800
@@ -467 +467 @@
-                            let weeksInYear = lastWeek == 1 ? CountableRange(weeksRange).last! : lastWeek
+                            let weeksInYear = lastWeek == 1 ? weeksRange.last! : lastWeek
@@ -495 +495 @@
-                                if let date = calendar.date(fromRelative: comps) {
+                                if let date = calendar.date(from: comps) {
@@ -541 +541 @@
-                                            days = Array(CountableRange(range).indices)
+                                            days = Array(range.indices)

The issues with the original code are:

  1. CountableRange is now an alias to Range. No need to convert any more.
  2. Calendar.date() doesn't have fromRelative param.

BTW, I wasn't able to use the library successfully using cocoapods. The app I created was a command line app. I was able to install the library in my app using the workaround suggested by johnsusek in #1. But building my app failed with dyld: Library not loaded: Reason: image not found. Not sure why. So I actually copied RWMRecurrenceRule.swift, RWMRuleParser.swift, RWMRuleScheduler.swift, and test files to my project (I didn't try those EKEvent, EKRecurrenceRule, and Calendar extension files).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions