From 3453320c84b4e254b6eeb97313d1cc846f3f1d45 Mon Sep 17 00:00:00 2001 From: Tom Quist Date: Fri, 6 Oct 2017 11:36:28 +0200 Subject: [PATCH 1/2] Added cocoapods support --- RRuleSwift.podspec | 20 ++++++++++++++++++++ Sources/JavaScriptBridge.swift | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 RRuleSwift.podspec diff --git a/RRuleSwift.podspec b/RRuleSwift.podspec new file mode 100644 index 0000000..3293f3e --- /dev/null +++ b/RRuleSwift.podspec @@ -0,0 +1,20 @@ +Pod::Spec.new do |s| + s.name = "RRuleSwift" + s.version = "0.2.0" + s.summary = "Swift rrule library for working with recurrence rules of calendar dates." + s.description = <<-DESC + Swift rrule library for working with recurrence rules of calendar dates. + It wraps the rrule.js library (https://github.com/jkbrzt/rrule). + DESC + + s.homepage = "https://github.com/teambition/RRuleSwift" + s.screenshots = "https://raw.githubusercontent.com/teambition/RRuleSwift/master/Gif/RRuleSwiftExample.gif" + s.license = "MIT" + s.author = { 'Teambition' => 'dev@teambition.com' } + s.ios.deployment_target = "8.0" + s.watchos.deployment_target = "2.0" + s.source = { :git => "https://github.com/teambition/RRuleSwift.git", :tag => "#{s.version}" } + s.source_files = "Sources", "Sources/**/*.{h,m}" + s.watchos.exclude_files = "Sources/JavaScriptBridge.swift", "Sources/Iterators.swift" + s.resource = "Sources/lib/*.js" +end diff --git a/Sources/JavaScriptBridge.swift b/Sources/JavaScriptBridge.swift index 364261e..512e213 100644 --- a/Sources/JavaScriptBridge.swift +++ b/Sources/JavaScriptBridge.swift @@ -10,8 +10,12 @@ import Foundation import EventKit internal struct JavaScriptBridge { + + // This class is needed to be able to get out bundle + private class DummyClass {} + internal static func rrulejs() -> String? { - let libPath = Bundle(identifier: "Teambition.RRuleSwift-iOS")?.path(forResource: "rrule", ofType: "js") ?? Bundle.main.path(forResource: "rrule", ofType: "js") + let libPath = Bundle(for: DummyClass.self).path(forResource: "rrule", ofType: "js") ?? Bundle.main.path(forResource: "rrule", ofType: "js") guard let rrulelibPath = libPath else { return nil } From 75484e10b380a7163c7010826eb72b371854c787 Mon Sep 17 00:00:00 2001 From: Tom Quist Date: Fri, 6 Oct 2017 11:38:29 +0200 Subject: [PATCH 2/2] Added frameworks --- RRuleSwift.podspec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/RRuleSwift.podspec b/RRuleSwift.podspec index 3293f3e..94e4cfa 100644 --- a/RRuleSwift.podspec +++ b/RRuleSwift.podspec @@ -14,7 +14,9 @@ Pod::Spec.new do |s| s.ios.deployment_target = "8.0" s.watchos.deployment_target = "2.0" s.source = { :git => "https://github.com/teambition/RRuleSwift.git", :tag => "#{s.version}" } - s.source_files = "Sources", "Sources/**/*.{h,m}" + s.source_files = "Sources", "Sources/**/*.{h,m}" s.watchos.exclude_files = "Sources/JavaScriptBridge.swift", "Sources/Iterators.swift" - s.resource = "Sources/lib/*.js" + s.resource = "Sources/lib/*.js" + s.frameworks = "Foundation", "EventKit" + s.ios.frameworks = "Foundation", "EventKit", "JavaScriptCore" end