diff --git a/Caravel.xcodeproj/project.pbxproj b/Caravel.xcodeproj/project.pbxproj
index ae9a981..e832d50 100644
--- a/Caravel.xcodeproj/project.pbxproj
+++ b/Caravel.xcodeproj/project.pbxproj
@@ -184,6 +184,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
+ English,
en,
);
mainGroup = A7F1DD881B17D957001E9B94;
@@ -290,6 +291,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -330,6 +332,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
+ SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
@@ -351,7 +354,7 @@
PRODUCT_NAME = Caravel;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -368,7 +371,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = Caravel;
SKIP_INSTALL = YES;
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 5.0;
};
name = Release;
};
diff --git a/caravel-test.xcodeproj/project.pbxproj b/caravel-test.xcodeproj/project.pbxproj
index 5bca9df..cf1fbb0 100644
--- a/caravel-test.xcodeproj/project.pbxproj
+++ b/caravel-test.xcodeproj/project.pbxproj
@@ -319,6 +319,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
+ English,
en,
Base,
);
@@ -475,11 +476,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -515,10 +517,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
+ SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -534,7 +537,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.coshx.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -549,7 +552,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.coshx.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -569,7 +572,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.coshx.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/caravel-test.app/caravel-test";
};
name = Debug;
@@ -586,7 +589,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.coshx.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/caravel-test.app/caravel-test";
};
name = Release;
diff --git a/caravel-test/AppDelegate.swift b/caravel-test/AppDelegate.swift
index 6cf98f7..aeaa45d 100644
--- a/caravel-test/AppDelegate.swift
+++ b/caravel-test/AppDelegate.swift
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
diff --git a/caravel-test/BaseController.swift b/caravel-test/BaseController.swift
index 7515de6..6b0f273 100644
--- a/caravel-test/BaseController.swift
+++ b/caravel-test/BaseController.swift
@@ -25,9 +25,9 @@ open class BaseController: UIViewController {
return wkWebViewConfigurations[index]
}
- func setUp(_ page: String, webView: UIWebView) -> ((Void) -> Void, EventBus.Draft?) {
+ func setUp(_ page: String, webView: UIWebView) -> (() -> Void, EventBus.Draft?) {
var draft: EventBus.Draft?
- var action: (Void) -> Void
+ var action: () -> Void
let request = URLRequest(url: Bundle.main.url(forResource: page, withExtension: "html")!)
if BaseController.isUsingWKWebView {
diff --git a/caravel-test/BasicTriggeringController.swift b/caravel-test/BasicTriggeringController.swift
index 06c2f93..e06089c 100644
--- a/caravel-test/BasicTriggeringController.swift
+++ b/caravel-test/BasicTriggeringController.swift
@@ -18,7 +18,7 @@ open class BasicTriggeringController: BaseController {
}
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
} else {
Caravel.getDefault(self, webView: _webView, whenReady: action)
}
diff --git a/caravel-test/BenchmarkController.swift b/caravel-test/BenchmarkController.swift
index 966ab29..fb7db91 100644
--- a/caravel-test/BenchmarkController.swift
+++ b/caravel-test/BenchmarkController.swift
@@ -27,7 +27,7 @@ class BenchmarkController: UIViewController {
webView.removeFromSuperview()
self.view.addSubview(self.wkWebView!)
- Caravel.getDefault(self, wkWebView: self.wkWebView!, draft: draft, whenReady: action)
+ Caravel.getDefaultReady(self, wkWebView: self.wkWebView!, draft: draft, whenReady: action)
self.wkWebView!.load(request)
} else {
diff --git a/caravel-test/EventDataController.swift b/caravel-test/EventDataController.swift
index 877b09a..79cb3ca 100644
--- a/caravel-test/EventDataController.swift
+++ b/caravel-test/EventDataController.swift
@@ -184,7 +184,7 @@ open class EventDataController: BaseController {
}
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
} else {
Caravel.getDefault(self, webView: _webView, whenReady: action)
}
diff --git a/caravel-test/EventNameController.swift b/caravel-test/EventNameController.swift
index bdc5e4f..3dc9dab 100644
--- a/caravel-test/EventNameController.swift
+++ b/caravel-test/EventNameController.swift
@@ -21,7 +21,7 @@ open class EventNameController: BaseController {
}
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
} else {
Caravel.getDefault(self, webView: _webView, whenReady: action)
}
diff --git a/caravel-test/InitializationController.swift b/caravel-test/InitializationController.swift
index 7f13ae8..3671c67 100644
--- a/caravel-test/InitializationController.swift
+++ b/caravel-test/InitializationController.swift
@@ -18,7 +18,7 @@ open class InitializationController: BaseController {
}
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
} else {
Caravel.getDefault(self, webView: _webView, whenReady: action)
}
@@ -26,7 +26,7 @@ open class InitializationController: BaseController {
tuple.0()
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action2)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action2)
} else {
Caravel.getDefault(self, webView: _webView, whenReady: action2)
}
diff --git a/caravel-test/MultipleSubscriberController.swift b/caravel-test/MultipleSubscriberController.swift
index 23a387d..da659ad 100644
--- a/caravel-test/MultipleSubscriberController.swift
+++ b/caravel-test/MultipleSubscriberController.swift
@@ -15,7 +15,7 @@ open class MultipleSubscriberController: BaseController {
}
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
} else {
Caravel.getDefault(self, webView: _webView, whenReady: action)
}
diff --git a/caravel-test/TwoBucketController.swift b/caravel-test/TwoBucketController.swift
index 9aa6b61..9d33545 100644
--- a/caravel-test/TwoBucketController.swift
+++ b/caravel-test/TwoBucketController.swift
@@ -39,8 +39,8 @@ class TwoBucketController: BaseController {
}
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(0), draft: tuple1.1!, whenReady: action1)
- Caravel.getDefault(self, wkWebView: getWKWebView(1), draft: tuple2.1!, whenReady: action2)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(0), draft: tuple1.1!, whenReady: action1)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(1), draft: tuple2.1!, whenReady: action2)
} else {
Caravel.getDefault(self, webView: webView1, whenReady: action1)
Caravel.getDefault(self, webView: webView2, whenReady: action2)
diff --git a/caravel-test/TwoEventController.swift b/caravel-test/TwoEventController.swift
index ca15755..d6a28c4 100644
--- a/caravel-test/TwoEventController.swift
+++ b/caravel-test/TwoEventController.swift
@@ -21,7 +21,7 @@ open class TwoEventController: BaseController {
}
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
} else {
Caravel.getDefault(self, webView: _webView, whenReady: action)
}
diff --git a/caravel-test/UnregistrationController.swift b/caravel-test/UnregistrationController.swift
index a6316b2..db8c387 100644
--- a/caravel-test/UnregistrationController.swift
+++ b/caravel-test/UnregistrationController.swift
@@ -40,7 +40,7 @@ class UnregistrationController: BaseController {
}
if BaseController.isUsingWKWebView {
- Caravel.getDefault(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
+ Caravel.getDefaultReady(self, wkWebView: getWKWebView(), draft: tuple.1!, whenReady: action)
} else {
Caravel.getDefault(self, webView: webView, whenReady: action)
}
@@ -59,7 +59,7 @@ class UnregistrationController: BaseController {
}
}
- func unsubscribe() {
+ @objc func unsubscribe() {
self.bus!.unregister()
self.timer?.invalidate()
self.timer = nil
diff --git a/caravel.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/caravel.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/caravel.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/caravel/Caravel.swift b/caravel/Caravel.swift
index f7103aa..5cc9ea4 100644
--- a/caravel/Caravel.swift
+++ b/caravel/Caravel.swift
@@ -212,7 +212,7 @@ open class Caravel {
- returns: Current instance
*/
- open static func getDefault(_ subscriber: AnyObject, webView: UIWebView, whenReady: @escaping (EventBus) -> Void) -> Caravel {
+ public static func getDefault(_ subscriber: AnyObject, webView: UIWebView, whenReady: @escaping (EventBus) -> Void) -> Caravel {
let d = CaravelFactory.getDefault()
try! testSubscriber(subscriber, target: webView)
d.addBus(subscriber, webView: webView, whenReady: whenReady, inBackground: true)
@@ -228,7 +228,7 @@ open class Caravel {
- returns: Current instance
*/
- open static func getDefault(_ subscriber: AnyObject, webView: UIWebView, whenReadyOnMain: @escaping (EventBus) -> Void) -> Caravel {
+ public static func getDefault(_ subscriber: AnyObject, webView: UIWebView, whenReadyOnMain: @escaping (EventBus) -> Void) -> Caravel {
let d = CaravelFactory.getDefault()
try! testSubscriber(subscriber, target: webView)
d.addBus(subscriber, webView: webView, whenReady: whenReadyOnMain, inBackground: false)
@@ -245,7 +245,7 @@ open class Caravel {
- returns: Current instance
*/
- open static func get(_ subscriber: AnyObject, name: String, webView: UIWebView, whenReady: @escaping (EventBus) -> Void) -> Caravel {
+ public static func get(_ subscriber: AnyObject, name: String, webView: UIWebView, whenReady: @escaping (EventBus) -> Void) -> Caravel {
let d = CaravelFactory.get(name)
try! testSubscriber(subscriber, target: webView)
d.addBus(subscriber, webView: webView, whenReady: whenReady, inBackground: true)
@@ -262,7 +262,7 @@ open class Caravel {
- returns: Current instance
*/
- open static func get(_ subscriber: AnyObject, name: String, webView: UIWebView, whenReadyOnMain: @escaping (EventBus) -> Void) -> Caravel {
+ public static func get(_ subscriber: AnyObject, name: String, webView: UIWebView, whenReadyOnMain: @escaping (EventBus) -> Void) -> Caravel {
let d = CaravelFactory.get(name)
try! testSubscriber(subscriber, target: webView)
d.addBus(subscriber, webView: webView, whenReady: whenReadyOnMain, inBackground: false)
@@ -276,7 +276,7 @@ open class Caravel {
- returns: Bus draft
*/
- open static func getDraft(_ configuration: WKWebViewConfiguration) -> EventBus.Draft {
+ public static func getDraft(_ configuration: WKWebViewConfiguration) -> EventBus.Draft {
return EventBus.buildDraft(configuration)
}
@@ -290,7 +290,7 @@ open class Caravel {
- returns: Current instance
*/
- open static func getDefault(_ subscriber: AnyObject, wkWebView: WKWebView, draft: EventBus.Draft, whenReady: @escaping (EventBus) -> Void) -> Caravel {
+ public static func getDefaultReady(_ subscriber: AnyObject, wkWebView: WKWebView, draft: EventBus.Draft, whenReady: @escaping (EventBus) -> Void) -> Caravel {
let d = CaravelFactory.getDefault()
try! testSubscriber(subscriber, target: wkWebView)
d.addBus(subscriber, wkWebView: wkWebView, draft: draft, whenReady: whenReady, inBackground: true)
@@ -307,7 +307,7 @@ open class Caravel {
- returns: Current instance
*/
- open static func getDefault(_ subscriber: AnyObject, wkWebView: WKWebView, draft: EventBus.Draft, whenReadyOnMain: @escaping (EventBus) -> Void) -> Caravel {
+ public static func getDefaultReadyOnMain(_ subscriber: AnyObject, wkWebView: WKWebView, draft: EventBus.Draft, whenReadyOnMain: @escaping (EventBus) -> Void) -> Caravel {
let d = CaravelFactory.getDefault()
try! testSubscriber(subscriber, target: wkWebView)
d.addBus(subscriber, wkWebView: wkWebView, draft: draft, whenReady: whenReadyOnMain, inBackground: false)
@@ -325,7 +325,7 @@ open class Caravel {
- returns: Current instance
*/
- open static func get(_ subscriber: AnyObject, name: String, wkWebView: WKWebView, draft: EventBus.Draft, whenReady: @escaping (EventBus) -> Void) -> Caravel {
+ public static func get(_ subscriber: AnyObject, name: String, wkWebView: WKWebView, draft: EventBus.Draft, whenReady: @escaping (EventBus) -> Void) -> Caravel {
let d = CaravelFactory.get(name)
try! testSubscriber(subscriber, target: wkWebView)
d.addBus(subscriber, wkWebView: wkWebView, draft: draft, whenReady: whenReady, inBackground: true)
@@ -343,7 +343,7 @@ open class Caravel {
- returns: Current instance
*/
- open static func get(_ subscriber: AnyObject, name: String, wkWebView: WKWebView, draft: EventBus.Draft, whenReadyOnMain: @escaping (EventBus) -> Void) -> Caravel {
+ public static func get(_ subscriber: AnyObject, name: String, wkWebView: WKWebView, draft: EventBus.Draft, whenReadyOnMain: @escaping (EventBus) -> Void) -> Caravel {
let d = CaravelFactory.get(name)
try! testSubscriber(subscriber, target: wkWebView)
d.addBus(subscriber, wkWebView: wkWebView, draft: draft, whenReady: whenReadyOnMain, inBackground: false)
diff --git a/caravel/internal/DataSerializer.swift b/caravel/internal/DataSerializer.swift
index 24fb263..9a71a06 100644
--- a/caravel/internal/DataSerializer.swift
+++ b/caravel/internal/DataSerializer.swift
@@ -39,7 +39,7 @@ internal class DataSerializer {
}
internal static func deserialize(_ input: String) -> AnyObject {
- if input.characters.count > 0 {
+ if input.count > 0 {
if (input.first == "[" && input.last == "]") || (input.first == "{" && input.last == "}") {
// Array or Dictionary, matching JSON format
let json = input.data(using: String.Encoding.utf8, allowLossyConversion: false)!
@@ -53,7 +53,7 @@ internal class DataSerializer {
}
var isNumber = true
- for i in 0.. Bool {
+ func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool {
var shouldLoad = true // Default behavior: execute URL
let original = self.originalDelegate?.webView?(webView, shouldStartLoadWith: request, navigationType: navigationType)
diff --git a/caravel/internal/proxies/UIWebViewDelegateProxyMediator.swift b/caravel/internal/proxies/UIWebViewDelegateProxyMediator.swift
index b4ada97..eca5999 100644
--- a/caravel/internal/proxies/UIWebViewDelegateProxyMediator.swift
+++ b/caravel/internal/proxies/UIWebViewDelegateProxyMediator.swift
@@ -18,7 +18,7 @@ internal class UIWebViewDelegateProxyMediator {
}
static func subscribe(_ webView: UIWebView, observer: IUIWebViewObserver) {
- let action: (Void) -> Bool = {
+ let action: () -> Bool = {
for (k, v) in proxies {
if k == webView.hash {
v.subscribe(observer)
diff --git a/caravel/utils/StringExtension.swift b/caravel/utils/StringExtension.swift
index 7107628..e1e4def 100644
--- a/caravel/utils/StringExtension.swift
+++ b/caravel/utils/StringExtension.swift
@@ -3,7 +3,7 @@ import Foundation
internal extension String {
var length: Int {
- return self.characters.count
+ return self.count
}
var first: String? {
@@ -23,7 +23,7 @@ internal extension String {
}
subscript (i: Int) -> Character {
- return self[self.characters.index(self.startIndex, offsetBy: i)]
+ return self[self.index(self.startIndex, offsetBy: i)]
}
subscript (i: Int) -> String {
@@ -31,6 +31,6 @@ internal extension String {
}
subscript (r: Range) -> String {
- return substring(with: (characters.index(startIndex, offsetBy: r.lowerBound) ..< characters.index(startIndex, offsetBy: r.upperBound)))
+ return substring(with: (index(startIndex, offsetBy: r.lowerBound) ..< index(startIndex, offsetBy: r.upperBound)))
}
}