From 6071f652589338c231d39c0d63a03192baa2d7ca Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Thu, 26 Aug 2021 07:57:48 +0530 Subject: [PATCH 01/10] macOS framework target Signed-off-by: Nikhil Nigade --- RRuleSwift-macOS/RRuleSwift_macOS.h | 19 ++ RRuleSwift.xcodeproj/project.pbxproj | 177 +++++++++++++++++- .../xcschemes/RRuleSwift iOS.xcscheme | 6 +- .../xcschemes/RRuleSwift watchOS.xcscheme | 6 +- Sources/JavaScriptBridge.swift | 6 + 5 files changed, 201 insertions(+), 13 deletions(-) create mode 100644 RRuleSwift-macOS/RRuleSwift_macOS.h diff --git a/RRuleSwift-macOS/RRuleSwift_macOS.h b/RRuleSwift-macOS/RRuleSwift_macOS.h new file mode 100644 index 0000000..ca5b083 --- /dev/null +++ b/RRuleSwift-macOS/RRuleSwift_macOS.h @@ -0,0 +1,19 @@ +// +// RRuleSwift_macOS.h +// RRuleSwift-macOS +// +// Created by Nikhil Nigade on 26/08/21. +// Copyright © 2021 Teambition. All rights reserved. +// + +#import + +//! Project version number for RRuleSwift_macOS. +FOUNDATION_EXPORT double RRuleSwift_macOSVersionNumber; + +//! Project version string for RRuleSwift_macOS. +FOUNDATION_EXPORT const unsigned char RRuleSwift_macOSVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/RRuleSwift.xcodeproj/project.pbxproj b/RRuleSwift.xcodeproj/project.pbxproj index 54d9a9c..0be52ad 100644 --- a/RRuleSwift.xcodeproj/project.pbxproj +++ b/RRuleSwift.xcodeproj/project.pbxproj @@ -27,6 +27,19 @@ EB48D1761D641D45001EE872 /* RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15C1D641D45001EE872 /* RRule.swift */; }; EB48D17B1D641D45001EE872 /* RRuleSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = EB48D1601D641D45001EE872 /* RRuleSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; EB48D17C1D641D45001EE872 /* RRuleSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = EB48D1601D641D45001EE872 /* RRuleSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F0EB3A5126D72D8E00FDA3AE /* RRuleSwift_macOS.h in Headers */ = {isa = PBXBuildFile; fileRef = F0EB3A5026D72D8E00FDA3AE /* RRuleSwift_macOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F0EB3A5526D72DC400FDA3AE /* ExclusionDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1521D641D45001EE872 /* ExclusionDate.swift */; }; + F0EB3A5626D72DC400FDA3AE /* Iterators.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1531D641D45001EE872 /* Iterators.swift */; }; + F0EB3A5726D72DC400FDA3AE /* RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15C1D641D45001EE872 /* RRule.swift */; }; + F0EB3A5826D72DC400FDA3AE /* EKWeekday+RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1511D641D45001EE872 /* EKWeekday+RRule.swift */; }; + F0EB3A5926D72DC400FDA3AE /* RecurrenceRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15B1D641D45001EE872 /* RecurrenceRule.swift */; }; + F0EB3A5A26D72DC400FDA3AE /* RecurrenceFrequency.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15A1D641D45001EE872 /* RecurrenceFrequency.swift */; }; + F0EB3A5B26D72DC400FDA3AE /* NSDate+Comparison.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1591D641D45001EE872 /* NSDate+Comparison.swift */; }; + F0EB3A5C26D72DC400FDA3AE /* InclusionDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1541D641D45001EE872 /* InclusionDate.swift */; }; + F0EB3A5D26D72DC400FDA3AE /* JavaScriptBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1551D641D45001EE872 /* JavaScriptBridge.swift */; }; + F0EB3A5E26D72DCA00FDA3AE /* nlp.js in Resources */ = {isa = PBXBuildFile; fileRef = EB48D1571D641D45001EE872 /* nlp.js */; }; + F0EB3A5F26D72DCA00FDA3AE /* rrule.js in Resources */ = {isa = PBXBuildFile; fileRef = EB48D1581D641D45001EE872 /* rrule.js */; }; + F0EB3A6026D72DD200FDA3AE /* RRuleSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = EB48D1601D641D45001EE872 /* RRuleSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -46,6 +59,8 @@ EB48D15E1D641D45001EE872 /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; }; EB48D15F1D641D45001EE872 /* Info-watchOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-watchOS.plist"; sourceTree = ""; }; EB48D1601D641D45001EE872 /* RRuleSwift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RRuleSwift.h; sourceTree = ""; }; + F0EB3A4E26D72D8E00FDA3AE /* RRuleSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RRuleSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F0EB3A5026D72D8E00FDA3AE /* RRuleSwift_macOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RRuleSwift_macOS.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -63,6 +78,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F0EB3A4B26D72D8E00FDA3AE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -70,6 +92,7 @@ isa = PBXGroup; children = ( EB48D1311D641ABB001EE872 /* Sources */, + F0EB3A4F26D72D8E00FDA3AE /* RRuleSwift-macOS */, D31B13981CA8E02E00D0B863 /* Products */, ); sourceTree = ""; @@ -79,6 +102,7 @@ children = ( D31B13971CA8E02E00D0B863 /* RRuleSwift.framework */, EB48D1371D641AD6001EE872 /* RRuleSwift.framework */, + F0EB3A4E26D72D8E00FDA3AE /* RRuleSwift.framework */, ); name = Products; sourceTree = ""; @@ -120,6 +144,14 @@ path = "Supporting Files"; sourceTree = ""; }; + F0EB3A4F26D72D8E00FDA3AE /* RRuleSwift-macOS */ = { + isa = PBXGroup; + children = ( + F0EB3A5026D72D8E00FDA3AE /* RRuleSwift_macOS.h */, + ); + path = "RRuleSwift-macOS"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -139,6 +171,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F0EB3A4926D72D8E00FDA3AE /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + F0EB3A5126D72D8E00FDA3AE /* RRuleSwift_macOS.h in Headers */, + F0EB3A6026D72DD200FDA3AE /* RRuleSwift.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -178,13 +219,31 @@ productReference = EB48D1371D641AD6001EE872 /* RRuleSwift.framework */; productType = "com.apple.product-type.framework"; }; + F0EB3A4D26D72D8E00FDA3AE /* RRuleSwift-macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = F0EB3A5226D72D8E00FDA3AE /* Build configuration list for PBXNativeTarget "RRuleSwift-macOS" */; + buildPhases = ( + F0EB3A4926D72D8E00FDA3AE /* Headers */, + F0EB3A4A26D72D8E00FDA3AE /* Sources */, + F0EB3A4B26D72D8E00FDA3AE /* Frameworks */, + F0EB3A4C26D72D8E00FDA3AE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "RRuleSwift-macOS"; + productName = "RRuleSwift-macOS"; + productReference = F0EB3A4E26D72D8E00FDA3AE /* RRuleSwift.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ D31B138E1CA8E02E00D0B863 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = Teambition; TargetAttributes = { D31B13961CA8E02E00D0B863 = { @@ -195,6 +254,11 @@ CreatedOnToolsVersion = 7.3; LastSwiftMigration = 1020; }; + F0EB3A4D26D72D8E00FDA3AE = { + CreatedOnToolsVersion = 13.0; + DevelopmentTeam = XMJKJH96ZT; + ProvisioningStyle = Automatic; + }; }; }; buildConfigurationList = D31B13911CA8E02E00D0B863 /* Build configuration list for PBXProject "RRuleSwift" */; @@ -212,6 +276,7 @@ targets = ( D31B13961CA8E02E00D0B863 /* RRuleSwift-iOS */, EB48D1361D641AD6001EE872 /* RRuleSwift-watchOS */, + F0EB3A4D26D72D8E00FDA3AE /* RRuleSwift-macOS */, ); }; /* End PBXProject section */ @@ -233,6 +298,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F0EB3A4C26D72D8E00FDA3AE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F0EB3A5E26D72DCA00FDA3AE /* nlp.js in Resources */, + F0EB3A5F26D72DCA00FDA3AE /* rrule.js in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -266,6 +340,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F0EB3A4A26D72D8E00FDA3AE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F0EB3A5C26D72DC400FDA3AE /* InclusionDate.swift in Sources */, + F0EB3A5526D72DC400FDA3AE /* ExclusionDate.swift in Sources */, + F0EB3A5626D72DC400FDA3AE /* Iterators.swift in Sources */, + F0EB3A5B26D72DC400FDA3AE /* NSDate+Comparison.swift in Sources */, + F0EB3A5A26D72DC400FDA3AE /* RecurrenceFrequency.swift in Sources */, + F0EB3A5726D72DC400FDA3AE /* RRule.swift in Sources */, + F0EB3A5D26D72DC400FDA3AE /* JavaScriptBridge.swift in Sources */, + F0EB3A5926D72DC400FDA3AE /* RecurrenceRule.swift in Sources */, + F0EB3A5826D72DC400FDA3AE /* EKWeekday+RRule.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ @@ -293,6 +383,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -318,7 +409,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -353,6 +444,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -372,7 +464,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -471,6 +563,76 @@ }; name = Release; }; + F0EB3A5326D72D8E00FDA3AE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = XMJKJH96ZT; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2021 Teambition. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 11.0; + MARKETING_VERSION = 0.5.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.dezinezync.RRuleSwift-macOS"; + PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; + PRODUCT_NAME = RRuleSwift; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + F0EB3A5426D72D8E00FDA3AE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = XMJKJH96ZT; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_C_LANGUAGE_STANDARD = gnu11; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2021 Teambition. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 11.0; + MARKETING_VERSION = 0.5.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.dezinezync.RRuleSwift-macOS"; + PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; + PRODUCT_NAME = RRuleSwift; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -501,6 +663,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + F0EB3A5226D72D8E00FDA3AE /* Build configuration list for PBXNativeTarget "RRuleSwift-macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F0EB3A5326D72D8E00FDA3AE /* Debug */, + F0EB3A5426D72D8E00FDA3AE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = D31B138E1CA8E02E00D0B863 /* Project object */; diff --git a/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRuleSwift iOS.xcscheme b/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRuleSwift iOS.xcscheme index 480332d..55c8185 100644 --- a/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRuleSwift iOS.xcscheme +++ b/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRuleSwift iOS.xcscheme @@ -1,6 +1,6 @@ - - - - - - - - String? { + + #if os(macOS) + let libPath = Bundle(identifier: "com.dezinezync.RRuleSwift-macOS")?.path(forResource: "rrule", ofType: "js") ?? Bundle.main.path(forResource: "rrule", ofType: "js") + #else let libPath = Bundle(identifier: "Teambition.RRuleSwift-iOS")?.path(forResource: "rrule", ofType: "js") ?? Bundle.main.path(forResource: "rrule", ofType: "js") + #endif + guard let rrulelibPath = libPath else { return nil } From d22fad1d351edaa0655d69fd7023a9911370f8cb Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Thu, 26 Aug 2021 10:09:49 +0530 Subject: [PATCH 02/10] make RecurrenceFrequency methods public Signed-off-by: Nikhil Nigade --- Sources/RecurrenceFrequency.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/RecurrenceFrequency.swift b/Sources/RecurrenceFrequency.swift index 1e57552..8183e7b 100644 --- a/Sources/RecurrenceFrequency.swift +++ b/Sources/RecurrenceFrequency.swift @@ -15,7 +15,7 @@ public enum RecurrenceFrequency { case minutely case secondly - internal func toString() -> String { + public func toString() -> String { switch self { case .secondly: return "SECONDLY" case .minutely: return "MINUTELY" @@ -27,7 +27,7 @@ public enum RecurrenceFrequency { } } - internal static func frequency(from string: String) -> RecurrenceFrequency? { + public static func frequency(from string: String) -> RecurrenceFrequency? { switch string { case "SECONDLY": return .secondly case "MINUTELY": return .minutely From 13429e7d08b346f0302eed53e4d37073c959b586 Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Tue, 31 Aug 2021 09:01:16 +0530 Subject: [PATCH 03/10] do not include header in project (not required) Signed-off-by: Nikhil Nigade --- RRuleSwift.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/RRuleSwift.xcodeproj/project.pbxproj b/RRuleSwift.xcodeproj/project.pbxproj index 0be52ad..a8a60fb 100644 --- a/RRuleSwift.xcodeproj/project.pbxproj +++ b/RRuleSwift.xcodeproj/project.pbxproj @@ -27,7 +27,6 @@ EB48D1761D641D45001EE872 /* RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15C1D641D45001EE872 /* RRule.swift */; }; EB48D17B1D641D45001EE872 /* RRuleSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = EB48D1601D641D45001EE872 /* RRuleSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; EB48D17C1D641D45001EE872 /* RRuleSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = EB48D1601D641D45001EE872 /* RRuleSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F0EB3A5126D72D8E00FDA3AE /* RRuleSwift_macOS.h in Headers */ = {isa = PBXBuildFile; fileRef = F0EB3A5026D72D8E00FDA3AE /* RRuleSwift_macOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; F0EB3A5526D72DC400FDA3AE /* ExclusionDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1521D641D45001EE872 /* ExclusionDate.swift */; }; F0EB3A5626D72DC400FDA3AE /* Iterators.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1531D641D45001EE872 /* Iterators.swift */; }; F0EB3A5726D72DC400FDA3AE /* RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15C1D641D45001EE872 /* RRule.swift */; }; @@ -175,7 +174,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - F0EB3A5126D72D8E00FDA3AE /* RRuleSwift_macOS.h in Headers */, F0EB3A6026D72DD200FDA3AE /* RRuleSwift.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; From ef7b34793aa7460cb38246a471149b113498cadc Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Thu, 9 Jun 2022 14:54:33 +0530 Subject: [PATCH 04/10] fix compile order --- RRuleSwift.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RRuleSwift.xcodeproj/project.pbxproj b/RRuleSwift.xcodeproj/project.pbxproj index a8a60fb..756388d 100644 --- a/RRuleSwift.xcodeproj/project.pbxproj +++ b/RRuleSwift.xcodeproj/project.pbxproj @@ -185,9 +185,9 @@ isa = PBXNativeTarget; buildConfigurationList = D31B139F1CA8E02E00D0B863 /* Build configuration list for PBXNativeTarget "RRuleSwift-iOS" */; buildPhases = ( + D31B13941CA8E02E00D0B863 /* Headers */, D31B13921CA8E02E00D0B863 /* Sources */, D31B13931CA8E02E00D0B863 /* Frameworks */, - D31B13941CA8E02E00D0B863 /* Headers */, D31B13951CA8E02E00D0B863 /* Resources */, ); buildRules = ( @@ -203,9 +203,9 @@ isa = PBXNativeTarget; buildConfigurationList = EB48D13C1D641AD6001EE872 /* Build configuration list for PBXNativeTarget "RRuleSwift-watchOS" */; buildPhases = ( + EB48D1341D641AD6001EE872 /* Headers */, EB48D1321D641AD6001EE872 /* Sources */, EB48D1331D641AD6001EE872 /* Frameworks */, - EB48D1341D641AD6001EE872 /* Headers */, EB48D1351D641AD6001EE872 /* Resources */, ); buildRules = ( From 8d3cedae2fe7d841895d1541e93e6c45d5b3b8e0 Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Fri, 10 Jun 2022 08:13:17 +0530 Subject: [PATCH 05/10] XC 14 B1 changes --- RRuleSwift.xcodeproj/project.pbxproj | 4 +++- .../xcshareddata/xcschemes/RRuleSwift iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/RRuleSwift watchOS.xcscheme | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/RRuleSwift.xcodeproj/project.pbxproj b/RRuleSwift.xcodeproj/project.pbxproj index 756388d..49a35f5 100644 --- a/RRuleSwift.xcodeproj/project.pbxproj +++ b/RRuleSwift.xcodeproj/project.pbxproj @@ -241,7 +241,7 @@ D31B138E1CA8E02E00D0B863 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1400; ORGANIZATIONNAME = Teambition; TargetAttributes = { D31B13961CA8E02E00D0B863 = { @@ -572,6 +572,7 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; + DEAD_CODE_STRIPPING = YES; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = XMJKJH96ZT; DYLIB_COMPATIBILITY_VERSION = 1; @@ -608,6 +609,7 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; + DEAD_CODE_STRIPPING = YES; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = XMJKJH96ZT; DYLIB_COMPATIBILITY_VERSION = 1; diff --git a/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRuleSwift iOS.xcscheme b/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRuleSwift iOS.xcscheme index 55c8185..6bbf1e7 100644 --- a/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRuleSwift iOS.xcscheme +++ b/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRuleSwift iOS.xcscheme @@ -1,6 +1,6 @@ Date: Sun, 21 Aug 2022 08:08:01 +0530 Subject: [PATCH 06/10] compile on latest XC 14 Beta --- RRuleSwift.xcodeproj/project.pbxproj | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/RRuleSwift.xcodeproj/project.pbxproj b/RRuleSwift.xcodeproj/project.pbxproj index 49a35f5..b6ae4dd 100644 --- a/RRuleSwift.xcodeproj/project.pbxproj +++ b/RRuleSwift.xcodeproj/project.pbxproj @@ -25,8 +25,6 @@ EB48D1741D641D45001EE872 /* RecurrenceRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15B1D641D45001EE872 /* RecurrenceRule.swift */; }; EB48D1751D641D45001EE872 /* RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15C1D641D45001EE872 /* RRule.swift */; }; EB48D1761D641D45001EE872 /* RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15C1D641D45001EE872 /* RRule.swift */; }; - EB48D17B1D641D45001EE872 /* RRuleSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = EB48D1601D641D45001EE872 /* RRuleSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EB48D17C1D641D45001EE872 /* RRuleSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = EB48D1601D641D45001EE872 /* RRuleSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; F0EB3A5526D72DC400FDA3AE /* ExclusionDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1521D641D45001EE872 /* ExclusionDate.swift */; }; F0EB3A5626D72DC400FDA3AE /* Iterators.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1531D641D45001EE872 /* Iterators.swift */; }; F0EB3A5726D72DC400FDA3AE /* RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D15C1D641D45001EE872 /* RRule.swift */; }; @@ -38,7 +36,6 @@ F0EB3A5D26D72DC400FDA3AE /* JavaScriptBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1551D641D45001EE872 /* JavaScriptBridge.swift */; }; F0EB3A5E26D72DCA00FDA3AE /* nlp.js in Resources */ = {isa = PBXBuildFile; fileRef = EB48D1571D641D45001EE872 /* nlp.js */; }; F0EB3A5F26D72DCA00FDA3AE /* rrule.js in Resources */ = {isa = PBXBuildFile; fileRef = EB48D1581D641D45001EE872 /* rrule.js */; }; - F0EB3A6026D72DD200FDA3AE /* RRuleSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = EB48D1601D641D45001EE872 /* RRuleSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -57,9 +54,7 @@ EB48D15C1D641D45001EE872 /* RRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RRule.swift; sourceTree = ""; }; EB48D15E1D641D45001EE872 /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; }; EB48D15F1D641D45001EE872 /* Info-watchOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-watchOS.plist"; sourceTree = ""; }; - EB48D1601D641D45001EE872 /* RRuleSwift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RRuleSwift.h; sourceTree = ""; }; F0EB3A4E26D72D8E00FDA3AE /* RRuleSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RRuleSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - F0EB3A5026D72D8E00FDA3AE /* RRuleSwift_macOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RRuleSwift_macOS.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -138,7 +133,6 @@ children = ( EB48D15E1D641D45001EE872 /* Info-iOS.plist */, EB48D15F1D641D45001EE872 /* Info-watchOS.plist */, - EB48D1601D641D45001EE872 /* RRuleSwift.h */, ); path = "Supporting Files"; sourceTree = ""; @@ -146,7 +140,6 @@ F0EB3A4F26D72D8E00FDA3AE /* RRuleSwift-macOS */ = { isa = PBXGroup; children = ( - F0EB3A5026D72D8E00FDA3AE /* RRuleSwift_macOS.h */, ); path = "RRuleSwift-macOS"; sourceTree = ""; @@ -158,7 +151,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - EB48D17B1D641D45001EE872 /* RRuleSwift.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -166,7 +158,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - EB48D17C1D641D45001EE872 /* RRuleSwift.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -174,7 +165,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - F0EB3A6026D72DD200FDA3AE /* RRuleSwift.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; From 58f2f65578b1c0fefbb1294b272718e06501acef Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Tue, 29 Nov 2022 06:32:53 +0530 Subject: [PATCH 07/10] generate XCFramework target --- .gitignore | 3 + RRule/RRule.h | 19 +++++ RRuleSwift.xcodeproj/project.pbxproj | 74 +++++++++++++++++++ .../contents.xcworkspacedata | 4 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ .../xcshareddata/xcschemes/RRule.xcscheme | 58 +++++++++++++++ .../xcschemes/XCFramework.xcscheme | 67 +++++++++++++++++ 7 files changed, 233 insertions(+) create mode 100644 RRule/RRule.h create mode 100644 RRuleSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 RRuleSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRule.xcscheme create mode 100644 RRuleSwift.xcodeproj/xcshareddata/xcschemes/XCFramework.xcscheme diff --git a/.gitignore b/.gitignore index fe427cf..5e5ee51 100644 --- a/.gitignore +++ b/.gitignore @@ -131,3 +131,6 @@ Carthage/Build fastlane/report.xml fastlane/screenshots +.DS_Store +/archives +/RRuleSwift.xcframework diff --git a/RRule/RRule.h b/RRule/RRule.h new file mode 100644 index 0000000..6e00464 --- /dev/null +++ b/RRule/RRule.h @@ -0,0 +1,19 @@ +// +// RRule.h +// RRule +// +// Created by Nikhil Nigade on 28/11/22. +// Copyright © 2022 Teambition. All rights reserved. +// + +#import + +//! Project version number for RRule. +FOUNDATION_EXPORT double RRuleVersionNumber; + +//! Project version string for RRule. +FOUNDATION_EXPORT const unsigned char RRuleVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/RRuleSwift.xcodeproj/project.pbxproj b/RRuleSwift.xcodeproj/project.pbxproj index b6ae4dd..f8181cc 100644 --- a/RRuleSwift.xcodeproj/project.pbxproj +++ b/RRuleSwift.xcodeproj/project.pbxproj @@ -6,6 +6,20 @@ objectVersion = 46; objects = { +/* Begin PBXAggregateTarget section */ + F05EA10A2934C8A900B30790 /* XCFramework */ = { + isa = PBXAggregateTarget; + buildConfigurationList = F05EA10B2934C8A900B30790 /* Build configuration list for PBXAggregateTarget "XCFramework" */; + buildPhases = ( + F05EA1142934C8C700B30790 /* ShellScript */, + ); + dependencies = ( + ); + name = XCFramework; + productName = Teambition.RRule; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ EB48D1611D641D45001EE872 /* EKWeekday+RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1511D641D45001EE872 /* EKWeekday+RRule.swift */; }; EB48D1621D641D45001EE872 /* EKWeekday+RRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB48D1511D641D45001EE872 /* EKWeekday+RRule.swift */; }; @@ -54,6 +68,7 @@ EB48D15C1D641D45001EE872 /* RRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RRule.swift; sourceTree = ""; }; EB48D15E1D641D45001EE872 /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; }; EB48D15F1D641D45001EE872 /* Info-watchOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-watchOS.plist"; sourceTree = ""; }; + F05EA1052934C89200B30790 /* RRule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RRule.h; sourceTree = ""; }; F0EB3A4E26D72D8E00FDA3AE /* RRuleSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RRuleSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -87,6 +102,7 @@ children = ( EB48D1311D641ABB001EE872 /* Sources */, F0EB3A4F26D72D8E00FDA3AE /* RRuleSwift-macOS */, + F05EA1042934C89200B30790 /* RRule */, D31B13981CA8E02E00D0B863 /* Products */, ); sourceTree = ""; @@ -137,6 +153,14 @@ path = "Supporting Files"; sourceTree = ""; }; + F05EA1042934C89200B30790 /* RRule */ = { + isa = PBXGroup; + children = ( + F05EA1052934C89200B30790 /* RRule.h */, + ); + path = RRule; + sourceTree = ""; + }; F0EB3A4F26D72D8E00FDA3AE /* RRuleSwift-macOS */ = { isa = PBXGroup; children = ( @@ -242,6 +266,10 @@ CreatedOnToolsVersion = 7.3; LastSwiftMigration = 1020; }; + F05EA10A2934C8A900B30790 = { + CreatedOnToolsVersion = 14.1; + ProvisioningStyle = Automatic; + }; F0EB3A4D26D72D8E00FDA3AE = { CreatedOnToolsVersion = 13.0; DevelopmentTeam = XMJKJH96ZT; @@ -265,6 +293,7 @@ D31B13961CA8E02E00D0B863 /* RRuleSwift-iOS */, EB48D1361D641AD6001EE872 /* RRuleSwift-watchOS */, F0EB3A4D26D72D8E00FDA3AE /* RRuleSwift-macOS */, + F05EA10A2934C8A900B30790 /* XCFramework */, ); }; /* End PBXProject section */ @@ -297,6 +326,26 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + F05EA1142934C8C700B30790 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/zsh; + shellScript = "# Remove existing xcframework if one exists\nrm -rf ./RRuleSwift.xcframework\n\nxcodebuild archive -project \"RRuleSwift.xcodeproj\" -scheme \"RRuleSwift iOS\" -destination \"generic/platform=iOS\" -archivePath \"archives/RRule-iOS\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -derivedDataPath ./DerivedData\n\nxcodebuild archive -project \"RRuleSwift.xcodeproj\" -scheme \"RRuleSwift iOS\" -destination \"generic/platform=iOS Simulator\" -archivePath \"archives/RRule-iOSSim\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -derivedDataPath ./DerivedData\n\nxcodebuild archive -project \"RRuleSwift.xcodeproj\" -scheme \"RRuleSwift watchOS\" -destination \"generic/platform=watchOS\" -archivePath \"archives/RRule-watchOS\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -derivedDataPath ./DerivedData\n\nxcodebuild archive -project \"RRuleSwift.xcodeproj\" -scheme \"RRuleSwift watchOS\" -destination \"generic/platform=watchOS Simulator\" -archivePath \"archives/RRule-watchOSSim\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -derivedDataPath ./DerivedData\n \nxcodebuild archive -project \"RRuleSwift.xcodeproj\" -scheme RRule -destination \"generic/platform=macOS\" -archivePath \"archives/RRule-macOS\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -derivedDataPath ./DerivedData\n \n# Build xcframework\nxcodebuild -create-xcframework \\\n -allow-internal-distribution \\\n -framework ./archives/RRule-iOS.xcarchive/Products/Library/Frameworks/RRuleSwift.framework \\\n -debug-symbols \"${PWD}/archives/RRule-iOS.xcarchive/dSYMs/RRuleSwift.framework.dSYM\" \\\n -framework ./archives/RRule-iOSSim.xcarchive/Products/Library/Frameworks/RRuleSwift.framework \\\n -debug-symbols \"${PWD}/archives/RRule-iOSSim.xcarchive/dSYMs/RRuleSwift.framework.dSYM\" \\\n -framework ./archives/RRule-watchOS.xcarchive/Products/Library/Frameworks/RRuleSwift.framework \\\n -debug-symbols \"${PWD}/archives/RRule-watchOS.xcarchive/dSYMs/RRuleSwift.framework.dSYM\" \\\n -framework ./archives/RRule-watchOSSim.xcarchive/Products/Library/Frameworks/RRuleSwift.framework \\\n -debug-symbols \"${PWD}/archives/RRule-watchOSSim.xcarchive/dSYMs/RRuleSwift.framework.dSYM\" \\\n -framework ./archives/RRule-macOS.xcarchive/Products/Library/Frameworks/RRuleSwift.framework \\\n -output RRuleSwift.xcframework\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ D31B13921CA8E02E00D0B863 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -551,6 +600,22 @@ }; name = Release; }; + F05EA10C2934C8A900B30790 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + F05EA10D2934C8A900B30790 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; F0EB3A5326D72D8E00FDA3AE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -653,6 +718,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + F05EA10B2934C8A900B30790 /* Build configuration list for PBXAggregateTarget "XCFramework" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F05EA10C2934C8A900B30790 /* Debug */, + F05EA10D2934C8A900B30790 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; F0EB3A5226D72D8E00FDA3AE /* Build configuration list for PBXNativeTarget "RRuleSwift-macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/RRuleSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/RRuleSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..94b2795 --- /dev/null +++ b/RRuleSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,4 @@ + + + diff --git a/RRuleSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/RRuleSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/RRuleSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRule.xcscheme b/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRule.xcscheme new file mode 100644 index 0000000..e24d0b4 --- /dev/null +++ b/RRuleSwift.xcodeproj/xcshareddata/xcschemes/RRule.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RRuleSwift.xcodeproj/xcshareddata/xcschemes/XCFramework.xcscheme b/RRuleSwift.xcodeproj/xcshareddata/xcschemes/XCFramework.xcscheme new file mode 100644 index 0000000..09b49eb --- /dev/null +++ b/RRuleSwift.xcodeproj/xcshareddata/xcschemes/XCFramework.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + From 070bc4f1dbfca74e18f530000726374de051528f Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Tue, 10 Jan 2023 18:52:57 +0530 Subject: [PATCH 08/10] expose NLP script `toText()` method on `RecurrenceRule` Signed-off-by: Nikhil Nigade --- RRuleSwift.xcodeproj/project.pbxproj | 6 +++--- RRuleSwiftExample.xcodeproj/project.pbxproj | 2 ++ .../RRuleExampleViewController.swift | 1 + Sources/Iterators.swift | 9 ++++++--- Sources/JavaScriptBridge.swift | 19 +++++++++++++------ Sources/RecurrenceRule.swift | 16 ++++++++++++++++ 6 files changed, 41 insertions(+), 12 deletions(-) diff --git a/RRuleSwift.xcodeproj/project.pbxproj b/RRuleSwift.xcodeproj/project.pbxproj index f8181cc..72cc2f0 100644 --- a/RRuleSwift.xcodeproj/project.pbxproj +++ b/RRuleSwift.xcodeproj/project.pbxproj @@ -57,14 +57,14 @@ EB48D1371D641AD6001EE872 /* RRuleSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RRuleSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EB48D1511D641D45001EE872 /* EKWeekday+RRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "EKWeekday+RRule.swift"; sourceTree = ""; }; EB48D1521D641D45001EE872 /* ExclusionDate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExclusionDate.swift; sourceTree = ""; }; - EB48D1531D641D45001EE872 /* Iterators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Iterators.swift; sourceTree = ""; }; + EB48D1531D641D45001EE872 /* Iterators.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = Iterators.swift; sourceTree = ""; tabWidth = 4; }; EB48D1541D641D45001EE872 /* InclusionDate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InclusionDate.swift; sourceTree = ""; }; - EB48D1551D641D45001EE872 /* JavaScriptBridge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JavaScriptBridge.swift; sourceTree = ""; }; + EB48D1551D641D45001EE872 /* JavaScriptBridge.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = JavaScriptBridge.swift; sourceTree = ""; tabWidth = 4; }; EB48D1571D641D45001EE872 /* nlp.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = nlp.js; sourceTree = ""; }; EB48D1581D641D45001EE872 /* rrule.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = rrule.js; sourceTree = ""; }; EB48D1591D641D45001EE872 /* NSDate+Comparison.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSDate+Comparison.swift"; sourceTree = ""; }; EB48D15A1D641D45001EE872 /* RecurrenceFrequency.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecurrenceFrequency.swift; sourceTree = ""; }; - EB48D15B1D641D45001EE872 /* RecurrenceRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecurrenceRule.swift; sourceTree = ""; }; + EB48D15B1D641D45001EE872 /* RecurrenceRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = RecurrenceRule.swift; sourceTree = ""; tabWidth = 4; }; EB48D15C1D641D45001EE872 /* RRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RRule.swift; sourceTree = ""; }; EB48D15E1D641D45001EE872 /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; }; EB48D15F1D641D45001EE872 /* Info-watchOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-watchOS.plist"; sourceTree = ""; }; diff --git a/RRuleSwiftExample.xcodeproj/project.pbxproj b/RRuleSwiftExample.xcodeproj/project.pbxproj index 8b86298..cfd744e 100644 --- a/RRuleSwiftExample.xcodeproj/project.pbxproj +++ b/RRuleSwiftExample.xcodeproj/project.pbxproj @@ -573,6 +573,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = "$(SRCROOT)/RRuleSwiftExample/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = Teambition.RRuleSwiftExample; PRODUCT_NAME = RRuleSwiftExample; @@ -585,6 +586,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = "$(SRCROOT)/RRuleSwiftExample/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = Teambition.RRuleSwiftExample; PRODUCT_NAME = RRuleSwiftExample; diff --git a/RRuleSwiftExample/RRuleExampleViewController.swift b/RRuleSwiftExample/RRuleExampleViewController.swift index 7a26e74..2834cc9 100644 --- a/RRuleSwiftExample/RRuleExampleViewController.swift +++ b/RRuleSwiftExample/RRuleExampleViewController.swift @@ -94,6 +94,7 @@ class RRuleExampleViewController: UIViewController { print(dateFormatter.string(from: occurrence)) } print("\n") + print("text: \(String(describing: rule.toText()))") } @objc func resetButtonTapped(_ sender: UIBarButtonItem) { diff --git a/Sources/Iterators.swift b/Sources/Iterators.swift index 2216377..0a7e016 100644 --- a/Sources/Iterators.swift +++ b/Sources/Iterators.swift @@ -12,7 +12,9 @@ import JavaScriptCore public struct Iterator { public static let endlessRecurrenceCount = 500 internal static let rruleContext: JSContext? = { - guard let rrulejs = JavaScriptBridge.rrulejs() else { + let scripts = JavaScriptBridge.rrulejs() + guard let rrulejs = scripts.lib, + let nlpJS = scripts.nlp else { return nil } let context = JSContext() @@ -20,13 +22,14 @@ public struct Iterator { print("[RRuleSwift] rrule.js error: \(String(describing: exception))") } let _ = context?.evaluateScript(rrulejs) + let _ = context?.evaluateScript(nlpJS) return context }() } public extension RecurrenceRule { func allOccurrences(endless endlessRecurrenceCount: Int = Iterator.endlessRecurrenceCount) -> [Date] { - guard let _ = JavaScriptBridge.rrulejs() else { + guard let _ = JavaScriptBridge.rrulejs().lib else { return [] } @@ -57,7 +60,7 @@ public extension RecurrenceRule { } func occurrences(between date: Date, and otherDate: Date, endless endlessRecurrenceCount: Int = Iterator.endlessRecurrenceCount) -> [Date] { - guard let _ = JavaScriptBridge.rrulejs() else { + guard let _ = JavaScriptBridge.rrulejs().lib else { return [] } diff --git a/Sources/JavaScriptBridge.swift b/Sources/JavaScriptBridge.swift index 834ef5c..ea5d857 100644 --- a/Sources/JavaScriptBridge.swift +++ b/Sources/JavaScriptBridge.swift @@ -10,22 +10,29 @@ import Foundation import EventKit internal struct JavaScriptBridge { - internal static func rrulejs() -> String? { + internal static func rrulejs() -> (lib: String?, nlp: String?) { #if os(macOS) let libPath = Bundle(identifier: "com.dezinezync.RRuleSwift-macOS")?.path(forResource: "rrule", ofType: "js") ?? Bundle.main.path(forResource: "rrule", ofType: "js") + let nlpPath = Bundle(identifier: "com.dezinezync.RRuleSwift-macOS")?.path(forResource: "nlp", ofType: "js") ?? Bundle.main.path(forResource: "nlp", ofType: "js") #else let libPath = Bundle(identifier: "Teambition.RRuleSwift-iOS")?.path(forResource: "rrule", ofType: "js") ?? Bundle.main.path(forResource: "rrule", ofType: "js") + let nlpPath = Bundle(identifier: "Teambition.RRuleSwift-iOS")?.path(forResource: "nlp", ofType: "js") ?? Bundle.main.path(forResource: "nlp", ofType: "js") #endif - guard let rrulelibPath = libPath else { - return nil + guard let rrulelibPath = libPath, + let nlpPath else { + return (nil, nil) } do { - return try String(contentsOfFile: rrulelibPath) - } catch _ { - return nil + let lib = try String(contentsOfFile: rrulelibPath) + let nlp = try String(contentsOfFile: nlpPath) + + return (lib, nlp) + } + catch _ { + return (nil, nil) } } } diff --git a/Sources/RecurrenceRule.swift b/Sources/RecurrenceRule.swift index 714022c..166d7a6 100644 --- a/Sources/RecurrenceRule.swift +++ b/Sources/RecurrenceRule.swift @@ -92,4 +92,20 @@ public struct RecurrenceRule { public func toRRuleString() -> String { return RRule.stringFromRule(self) } + + #if os(iOS) || os(macOS) + public func toText() -> String? { + let paths = JavaScriptBridge.rrulejs() + + guard let _ = paths.lib, + let _ = paths.nlp else { + return nil + } + + let ruleJSONString = toJSONString(endless: Iterator.endlessRecurrenceCount) + let _ = Iterator.rruleContext?.evaluateScript("var rule = new RRule({ \(ruleJSONString) })") + + return Iterator.rruleContext?.evaluateScript("rule.toText()").toString() + } + #endif } From fb14b86dfb55c70247ff002d888f2520f5a1dc3f Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Wed, 28 May 2025 09:26:33 +0530 Subject: [PATCH 09/10] =?UTF-8?q?remove=20=E2=80=9CendlessRecurrenceCount?= =?UTF-8?q?=E2=80=9D=20yeilding=20incorrect=20=E2=80=9CtoText=E2=80=9D=20s?= =?UTF-8?q?trings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nikhil Nigade --- Sources/Iterators.swift | 9 ++++----- Sources/JavaScriptBridge.swift | 4 +--- Sources/RecurrenceRule.swift | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Sources/Iterators.swift b/Sources/Iterators.swift index 0a7e016..7d84eb5 100644 --- a/Sources/Iterators.swift +++ b/Sources/Iterators.swift @@ -10,7 +10,6 @@ import Foundation import JavaScriptCore public struct Iterator { - public static let endlessRecurrenceCount = 500 internal static let rruleContext: JSContext? = { let scripts = JavaScriptBridge.rrulejs() guard let rrulejs = scripts.lib, @@ -28,12 +27,12 @@ public struct Iterator { } public extension RecurrenceRule { - func allOccurrences(endless endlessRecurrenceCount: Int = Iterator.endlessRecurrenceCount) -> [Date] { + func allOccurrences() -> [Date] { guard let _ = JavaScriptBridge.rrulejs().lib else { return [] } - let ruleJSONString = toJSONString(endless: endlessRecurrenceCount) + let ruleJSONString = toJSONString() let _ = Iterator.rruleContext?.evaluateScript("var rule = new RRule({ \(ruleJSONString) })") guard let allOccurrences = Iterator.rruleContext?.evaluateScript("rule.all()").toArray() as? [Date] else { return [] @@ -59,7 +58,7 @@ public extension RecurrenceRule { return occurrences.sorted { $0.isBeforeOrSame(with: $1) } } - func occurrences(between date: Date, and otherDate: Date, endless endlessRecurrenceCount: Int = Iterator.endlessRecurrenceCount) -> [Date] { + func occurrences(between date: Date, and otherDate: Date) -> [Date] { guard let _ = JavaScriptBridge.rrulejs().lib else { return [] } @@ -69,7 +68,7 @@ public extension RecurrenceRule { let beginDateJSON = RRule.ISO8601DateFormatter.string(from: beginDate) let untilDateJSON = RRule.ISO8601DateFormatter.string(from: untilDate) - let ruleJSONString = toJSONString(endless: endlessRecurrenceCount) + let ruleJSONString = toJSONString() let _ = Iterator.rruleContext?.evaluateScript("var rule = new RRule({ \(ruleJSONString) })") guard let betweenOccurrences = Iterator.rruleContext?.evaluateScript("rule.between(new Date('\(beginDateJSON)'), new Date('\(untilDateJSON)'))").toArray() as? [Date] else { return [] diff --git a/Sources/JavaScriptBridge.swift b/Sources/JavaScriptBridge.swift index ea5d857..577af25 100644 --- a/Sources/JavaScriptBridge.swift +++ b/Sources/JavaScriptBridge.swift @@ -66,7 +66,7 @@ internal extension EKWeekday { } internal extension RecurrenceRule { - func toJSONString(endless endlessRecurrenceCount: Int) -> String { + func toJSONString() -> String { var jsonString = "freq: \(frequency.toJSONFrequency())," jsonString += "interval: \(max(1, interval))," jsonString += "wkst: \(firstDayOfWeek.toJSONSymbol())," @@ -76,8 +76,6 @@ internal extension RecurrenceRule { jsonString += "until: new Date('\(RRule.ISO8601DateFormatter.string(from: endDate))')," } else if let count = recurrenceEnd?.occurrenceCount { jsonString += "count: \(count)," - } else { - jsonString += "count: \(endlessRecurrenceCount)," } let bysetposStrings = bysetpos.compactMap({ (setpo) -> String? in diff --git a/Sources/RecurrenceRule.swift b/Sources/RecurrenceRule.swift index 166d7a6..e7f67bb 100644 --- a/Sources/RecurrenceRule.swift +++ b/Sources/RecurrenceRule.swift @@ -102,7 +102,7 @@ public struct RecurrenceRule { return nil } - let ruleJSONString = toJSONString(endless: Iterator.endlessRecurrenceCount) + let ruleJSONString = toJSONString() let _ = Iterator.rruleContext?.evaluateScript("var rule = new RRule({ \(ruleJSONString) })") return Iterator.rruleContext?.evaluateScript("rule.toText()").toString() From c60d440298c7a9ec56cc659430a6f142d04c0888 Mon Sep 17 00:00:00 2001 From: Nikhil Nigade Date: Wed, 28 May 2025 09:49:09 +0530 Subject: [PATCH 10/10] only remove for `toText()`, make it optional. Additionally fixes compiler warning Signed-off-by: Nikhil Nigade --- Sources/EKWeekday+RRule.swift | 2 +- Sources/Iterators.swift | 30 ++++++++++++++++-------------- Sources/JavaScriptBridge.swift | 4 +++- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Sources/EKWeekday+RRule.swift b/Sources/EKWeekday+RRule.swift index 48c3c20..ab028ba 100644 --- a/Sources/EKWeekday+RRule.swift +++ b/Sources/EKWeekday+RRule.swift @@ -47,7 +47,7 @@ internal extension EKWeekday { } } -extension EKWeekday: Comparable { } +extension EKWeekday: @retroactive Comparable { } public func <(lhs: EKWeekday, rhs: EKWeekday) -> Bool { return lhs.toNumberSymbol() < rhs.toNumberSymbol() diff --git a/Sources/Iterators.swift b/Sources/Iterators.swift index 7d84eb5..30ee4de 100644 --- a/Sources/Iterators.swift +++ b/Sources/Iterators.swift @@ -10,6 +10,8 @@ import Foundation import JavaScriptCore public struct Iterator { + public static let endlessRecurrenceCount: Int = 500 + internal static let rruleContext: JSContext? = { let scripts = JavaScriptBridge.rrulejs() guard let rrulejs = scripts.lib, @@ -27,22 +29,22 @@ public struct Iterator { } public extension RecurrenceRule { - func allOccurrences() -> [Date] { + func allOccurrences(endless endlessRecurrenceCount: Int = Iterator.endlessRecurrenceCount) -> [Date] { guard let _ = JavaScriptBridge.rrulejs().lib else { return [] } - - let ruleJSONString = toJSONString() + + let ruleJSONString = toJSONString(endless: endlessRecurrenceCount) let _ = Iterator.rruleContext?.evaluateScript("var rule = new RRule({ \(ruleJSONString) })") guard let allOccurrences = Iterator.rruleContext?.evaluateScript("rule.all()").toArray() as? [Date] else { return [] } - + var occurrences = allOccurrences if let rdates = rdate?.dates { occurrences.append(contentsOf: rdates) } - + if let exdates = exdate?.dates, let component = exdate?.component { for occurrence in occurrences { for exdate in exdates { @@ -54,31 +56,31 @@ public extension RecurrenceRule { } } } - + return occurrences.sorted { $0.isBeforeOrSame(with: $1) } } - - func occurrences(between date: Date, and otherDate: Date) -> [Date] { + + func occurrences(between date: Date, and otherDate: Date, endless endlessRecurrenceCount: Int = Iterator.endlessRecurrenceCount) -> [Date] { guard let _ = JavaScriptBridge.rrulejs().lib else { return [] } - + let beginDate = date.isBeforeOrSame(with: otherDate) ? date : otherDate let untilDate = otherDate.isAfterOrSame(with: date) ? otherDate : date let beginDateJSON = RRule.ISO8601DateFormatter.string(from: beginDate) let untilDateJSON = RRule.ISO8601DateFormatter.string(from: untilDate) - - let ruleJSONString = toJSONString() + + let ruleJSONString = toJSONString(endless: endlessRecurrenceCount) let _ = Iterator.rruleContext?.evaluateScript("var rule = new RRule({ \(ruleJSONString) })") guard let betweenOccurrences = Iterator.rruleContext?.evaluateScript("rule.between(new Date('\(beginDateJSON)'), new Date('\(untilDateJSON)'))").toArray() as? [Date] else { return [] } - + var occurrences = betweenOccurrences if let rdates = rdate?.dates { occurrences.append(contentsOf: rdates) } - + if let exdates = exdate?.dates, let component = exdate?.component { for occurrence in occurrences { for exdate in exdates { @@ -90,7 +92,7 @@ public extension RecurrenceRule { } } } - + return occurrences.sorted { $0.isBeforeOrSame(with: $1) } } } diff --git a/Sources/JavaScriptBridge.swift b/Sources/JavaScriptBridge.swift index 577af25..043b86f 100644 --- a/Sources/JavaScriptBridge.swift +++ b/Sources/JavaScriptBridge.swift @@ -66,7 +66,7 @@ internal extension EKWeekday { } internal extension RecurrenceRule { - func toJSONString() -> String { + func toJSONString(endless endlessRecurrenceCount: Int? = nil) -> String { var jsonString = "freq: \(frequency.toJSONFrequency())," jsonString += "interval: \(max(1, interval))," jsonString += "wkst: \(firstDayOfWeek.toJSONSymbol())," @@ -76,6 +76,8 @@ internal extension RecurrenceRule { jsonString += "until: new Date('\(RRule.ISO8601DateFormatter.string(from: endDate))')," } else if let count = recurrenceEnd?.occurrenceCount { jsonString += "count: \(count)," + } else if let endlessRecurrenceCount { + jsonString += "count: \(endlessRecurrenceCount)," } let bysetposStrings = bysetpos.compactMap({ (setpo) -> String? in