From a24c890345b46ae460ff04fe8470b03bd0f2e424 Mon Sep 17 00:00:00 2001 From: Jubin Jacob Date: Fri, 25 Nov 2016 15:17:23 +0530 Subject: [PATCH 1/4] migration to swift 3 --- .gitignore | 2 +- Cartfile | 2 +- Cartfile.private | 4 +- Cartfile.resolved | 6 +-- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- Carthage/Checkouts/Result | 2 +- DemoApp/AppDelegate.swift | 2 +- DemoApp/CreateTodoViewController.swift | 6 +-- DemoApp/TodoAction.swift | 6 +-- DemoApp/TodoListViewController.swift | 24 +++++------ DemoApp/TodoStore.swift | 25 ++++++------ SwiftFlux.xcodeproj/project.pbxproj | 20 +++++----- SwiftFlux/Action.swift | 4 +- SwiftFlux/Dispatcher.swift | 32 +++++++-------- SwiftFlux/Store.swift | 29 +++++++------- SwiftFlux/Utils/ReduceStore.swift | 6 +-- SwiftFlux/Utils/StoreBase.swift | 8 ++-- SwiftFluxTests/ActionCreatorSpec.swift | 46 +++++++++++----------- SwiftFluxTests/DispatcherSpec.swift | 38 +++++++++--------- SwiftFluxTests/StoreSpec.swift | 14 +++---- SwiftFluxTests/Utils/ReduceStoreSpec.swift | 25 ++++++------ SwiftFluxTests/Utils/StoreBaseSpec.swift | 24 +++++------ 23 files changed, 166 insertions(+), 163 deletions(-) diff --git a/.gitignore b/.gitignore index 8615121..60089aa 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,6 @@ DerivedData # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts +Carthage/Checkouts Carthage/Build diff --git a/Cartfile b/Cartfile index 64e9e14..f2e9e88 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "antitypical/Result" ~> 2.1.0 +github "antitypical/Result" diff --git a/Cartfile.private b/Cartfile.private index 81cb391..c2786fb 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,2 +1,2 @@ -github "Quick/Quick" "v0.9.3" -github "Quick/Nimble" "v4.1.0" +github "Quick/Quick" +github "Quick/Nimble" diff --git a/Cartfile.resolved b/Cartfile.resolved index 1b5a1eb..61d87a5 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "Quick/Nimble" "v4.1.0" -github "Quick/Quick" "v0.9.3" -github "antitypical/Result" "2.1.3" +github "Quick/Nimble" "v5.1.1" +github "Quick/Quick" "v1.0.0" +github "antitypical/Result" "3.0.0" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index b4a0f9d..3720e6b 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit b4a0f9d6ee6b89f0e2f9ee8fa32aaa7200b1e27c +Subproject commit 3720e6b0f6de6d6435f79f8a174fb4bb92df5dc4 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index faa6056..9c03231 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit faa6056c0c7da69fc1fb494cf61fa264aea4d9bc +Subproject commit 9c032315fafca658668d49f6396f1f24b09a83b2 diff --git a/Carthage/Checkouts/Result b/Carthage/Checkouts/Result index 9b5e373..df233a8 160000 --- a/Carthage/Checkouts/Result +++ b/Carthage/Checkouts/Result @@ -1 +1 @@ -Subproject commit 9b5e373891dfe0de11ba2a8e9a5cafd570b858c4 +Subproject commit df233a8d23a545153d5b5de13b1ac8db2503f088 diff --git a/DemoApp/AppDelegate.swift b/DemoApp/AppDelegate.swift index 4746a5f..6300480 100644 --- a/DemoApp/AppDelegate.swift +++ b/DemoApp/AppDelegate.swift @@ -12,7 +12,7 @@ import UIKit class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { return true } } diff --git a/DemoApp/CreateTodoViewController.swift b/DemoApp/CreateTodoViewController.swift index b1ab04f..8c2217a 100644 --- a/DemoApp/CreateTodoViewController.swift +++ b/DemoApp/CreateTodoViewController.swift @@ -12,7 +12,7 @@ import SwiftFlux class CreateTodoViewController: UITableViewController { @IBOutlet weak var titleTextField: UITextField? - override func viewWillAppear(animated: Bool) { + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) titleTextField?.becomeFirstResponder() } @@ -21,11 +21,11 @@ class CreateTodoViewController: UITableViewController { guard let title = titleTextField?.text else { return } guard title.characters.count > 0 else { return } - ActionCreator.invoke(TodoAction.Create(title: title)) + ActionCreator.invoke(action: TodoAction.Create(title: title)) self.dismiss() } @IBAction func dismiss() { - self.dismissViewControllerAnimated(true, completion: nil) + self.dismiss(animated: true, completion: nil) } } diff --git a/DemoApp/TodoAction.swift b/DemoApp/TodoAction.swift index af74c85..a5b92f4 100644 --- a/DemoApp/TodoAction.swift +++ b/DemoApp/TodoAction.swift @@ -19,7 +19,7 @@ struct TodoAction { Todo(title: "ToDo 2"), Todo(title: "ToDo 3") ] - dispatcher.dispatch(self, result: Result(value: todos)) + dispatcher.dispatch(action: self, result: Result(value: todos)) } } @@ -28,7 +28,7 @@ struct TodoAction { let title: String func invoke(dispatcher: Dispatcher) { - dispatcher.dispatch(self, result: Result(value: Todo(title: title))) + dispatcher.dispatch(action: self, result: Result(value: Todo(title: title))) } } @@ -37,7 +37,7 @@ struct TodoAction { let index: Int func invoke(dispatcher: Dispatcher) { - dispatcher.dispatch(self, result: Result(value: index)) + dispatcher.dispatch(action: self, result: Result(value: index)) } } } diff --git a/DemoApp/TodoListViewController.swift b/DemoApp/TodoListViewController.swift index 4b453ca..b4cd69d 100644 --- a/DemoApp/TodoListViewController.swift +++ b/DemoApp/TodoListViewController.swift @@ -15,28 +15,30 @@ class TodoListViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - self.todoStore.subscribe { () in + let _ = self.todoStore.subscribe(store: self.todoStore) { self.tableView.reloadData() } - ActionCreator.invoke(TodoAction.Fetch()) + ActionCreator.invoke(action: TodoAction.Fetch()) } @IBAction func createTodo() { - ActionCreator.invoke(TodoAction.Create(title: "New ToDo")) + ActionCreator.invoke(action: TodoAction.Create(title: "New ToDo")) } - override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.todoStore.todos.count } - override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("TodoCell") as UITableViewCell! - cell.textLabel!.text = self.todoStore.todos[indexPath.row].title - return cell - } + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "TodoCell") as UITableViewCell! + cell?.textLabel!.text = self.todoStore.todos[indexPath.row].title + return cell! - override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { - ActionCreator.invoke(TodoAction.Delete(index: indexPath.row)) } + + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { + ActionCreator.invoke(action: TodoAction.Delete(index: indexPath.row)) + } + } diff --git a/DemoApp/TodoStore.swift b/DemoApp/TodoStore.swift index 5e2c9f0..90f06c7 100644 --- a/DemoApp/TodoStore.swift +++ b/DemoApp/TodoStore.swift @@ -14,34 +14,35 @@ class TodoStore : Store { private(set) var todos = [Todo]() init() { - ActionCreator.dispatcher.register(TodoAction.Fetch.self) { (result) in + + let _ = ActionCreator.dispatcher.register(type: TodoAction.Fetch.self) { (result) in switch result { - case .Success(let box): + case .success(let box): self.todos = box self.emitChange() - case .Failure(_): + case .failure(_): break; } } - ActionCreator.dispatcher.register(TodoAction.Create.self) { (result) in + let _ = ActionCreator.dispatcher.register(type: TodoAction.Create.self) { (result) in switch result { - case .Success(let box): - self.todos.insert(box, atIndex: 0) + case .success(let box): + self.todos.insert(box, at: 0) self.emitChange() - case .Failure(_): + case .failure(_): break; } } - ActionCreator.dispatcher.register(TodoAction.Delete.self) { (result) in + let _ = ActionCreator.dispatcher.register(type: TodoAction.Delete.self) { (result) in switch result { - case .Success(let box): - self.todos.removeAtIndex(box) + case .success(let box): + self.todos.remove(at: box) self.emitChange() - case .Failure(_): + case .failure(_): break; } } } -} \ No newline at end of file +} diff --git a/SwiftFlux.xcodeproj/project.pbxproj b/SwiftFlux.xcodeproj/project.pbxproj index a1991d0..afc8e95 100644 --- a/SwiftFlux.xcodeproj/project.pbxproj +++ b/SwiftFlux.xcodeproj/project.pbxproj @@ -796,7 +796,7 @@ SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; VALID_ARCHS = "i386 x86_64"; }; name = Debug; @@ -824,7 +824,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; VALID_ARCHS = "i386 x86_64"; }; name = Release; @@ -853,7 +853,7 @@ PRODUCT_NAME = SwiftFluxTests; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; VALID_ARCHS = "i386 x86_64"; }; name = Debug; @@ -876,7 +876,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = SwiftFluxTests; SDKROOT = macosx; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; VALID_ARCHS = "i386 x86_64"; }; name = Release; @@ -899,7 +899,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; }; name = Debug; }; @@ -917,7 +917,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; }; name = Release; }; @@ -1046,7 +1046,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; }; name = Debug; }; @@ -1073,7 +1073,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; }; name = Release; }; @@ -1094,7 +1094,7 @@ LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = SwiftFluxTests; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; }; name = Debug; }; @@ -1111,7 +1111,7 @@ LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = SwiftFluxTests; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; }; name = Release; }; diff --git a/SwiftFlux/Action.swift b/SwiftFlux/Action.swift index 96684f6..4c422ff 100644 --- a/SwiftFlux/Action.swift +++ b/SwiftFlux/Action.swift @@ -11,7 +11,7 @@ import Result public protocol Action { associatedtype Payload - associatedtype Error: ErrorType = NSError + associatedtype ActionError: Error = NSError func invoke(dispatcher: Dispatcher) } @@ -22,6 +22,6 @@ public class ActionCreator { } public class func invoke(action: T) { - action.invoke(self.dispatcher) + action.invoke(dispatcher: self.dispatcher) } } diff --git a/SwiftFlux/Dispatcher.swift b/SwiftFlux/Dispatcher.swift index c923dd5..7e44023 100644 --- a/SwiftFlux/Dispatcher.swift +++ b/SwiftFlux/Dispatcher.swift @@ -12,10 +12,10 @@ import Result public typealias DispatchToken = String public protocol Dispatcher { - func dispatch(action: T, result: Result) - func register(type: T.Type, handler: (Result) -> ()) -> DispatchToken + func dispatch(action: T, result: Result) + func register(type: T.Type, handler: @escaping (Result) -> Void) -> DispatchToken func unregister(dispatchToken: DispatchToken) - func waitFor(dispatchTokens: [DispatchToken], type: T.Type, result: Result) + func waitFor(dispatchTokens: [DispatchToken], type: T.Type, result: Result) } public class DefaultDispatcher: Dispatcher { @@ -33,21 +33,21 @@ public class DefaultDispatcher: Dispatcher { callbacks.removeAll() } - public func dispatch(action: T, result: Result) { - dispatch(action.dynamicType, result: result) + public func dispatch(action: T, result: Result) { + dispatch(type: type(of: action), result: result) } - public func register(type: T.Type, handler: (Result) -> Void) -> DispatchToken { - let nextDispatchToken = NSUUID().UUIDString + public func register(type: T.Type, handler: @escaping (Result) -> Void) -> DispatchToken { + let nextDispatchToken = NSUUID().uuidString callbacks[nextDispatchToken] = DispatchCallback(type: type, handler: handler) return nextDispatchToken } public func unregister(dispatchToken: DispatchToken) { - callbacks.removeValueForKey(dispatchToken) + callbacks.removeValue(forKey: dispatchToken) } - public func waitFor(dispatchTokens: [DispatchToken], type: T.Type, result: Result) { + public func waitFor(dispatchTokens: [DispatchToken], type: T.Type, result: Result) { for dispatchToken in dispatchTokens { guard let callback = callbacks[dispatchToken] as? DispatchCallback else { continue } switch callback.status { @@ -57,17 +57,17 @@ public class DefaultDispatcher: Dispatcher { // Circular dependency detected while continue default: - invokeCallback(dispatchToken, type: type, result: result) + invokeCallback(dispatchToken: dispatchToken, type: type, result: result) } } } - private func dispatch(type: T.Type, result: Result) { + private func dispatch(type: T.Type, result: Result) { objc_sync_enter(self) - startDispatching(type) + startDispatching(type: type) for dispatchToken in callbacks.keys { - invokeCallback(dispatchToken, type: type, result: result) + invokeCallback(dispatchToken: dispatchToken, type: type, result: result) } objc_sync_exit(self) @@ -80,7 +80,7 @@ public class DefaultDispatcher: Dispatcher { } } - private func invokeCallback(dispatchToken: DispatchToken, type: T.Type, result: Result) { + private func invokeCallback(dispatchToken: DispatchToken, type: T.Type, result: Result) { guard let callback = callbacks[dispatchToken] as? DispatchCallback else { return } guard callback.status == .Waiting else { return } @@ -92,10 +92,10 @@ public class DefaultDispatcher: Dispatcher { private class DispatchCallback { let type: T.Type - let handler: (Result) -> () + let handler: (Result) -> () var status = DefaultDispatcher.Status.Waiting - init(type: T.Type, handler: (Result) -> ()) { + init(type: T.Type, handler: @escaping (Result) -> ()) { self.type = type self.handler = handler } diff --git a/SwiftFlux/Store.swift b/SwiftFlux/Store.swift index 6b5e3d9..72e5999 100644 --- a/SwiftFlux/Store.swift +++ b/SwiftFlux/Store.swift @@ -25,31 +25,37 @@ extension Store { return eventEmitter } - public func subscribe(handler: () -> ()) -> StoreListenerToken { - return eventEmitter.subscribe(self, handler: handler) + public func subscribe(store: T, handler: @escaping () -> ()) -> String { + return eventEmitter.subscribe(store: self, handler: handler) } public func unsubscribe(listenerToken: StoreListenerToken) { - eventEmitter.unsubscribe(self, listenerToken: listenerToken) + eventEmitter.unsubscribe(store: self, listenerToken: listenerToken) } public func unsubscribeAll() { - eventEmitter.unsubscribe(self) + eventEmitter.unsubscribe(store: self) } public func emitChange() { - eventEmitter.emitChange(self) + eventEmitter.emitChange(store: self) } } public protocol EventEmitter { - func subscribe(store: T, handler: () -> ()) -> String + func subscribe(store: T, handler: @escaping () -> ()) -> String func unsubscribe(store: T) func unsubscribe(store: T, listenerToken: StoreListenerToken) func emitChange(store: T) } public class DefaultEventEmitter: EventEmitter { + public func subscribe(store: T, handler: @escaping () -> ()) -> String { + let nextListenerToken = NSUUID().uuidString + eventListeners[nextListenerToken] = EventListener(store: store, handler: handler) + return nextListenerToken + } + private var eventListeners: [StoreListenerToken: EventListener] = [:] public init() {} @@ -57,22 +63,17 @@ public class DefaultEventEmitter: EventEmitter { eventListeners.removeAll() } - public func subscribe(store: T, handler: () -> ()) -> StoreListenerToken { - let nextListenerToken = NSUUID().UUIDString - eventListeners[nextListenerToken] = EventListener(store: store, handler: handler) - return nextListenerToken - } public func unsubscribe(store: T) { eventListeners.forEach { (token, listener) -> () in if (listener.store === store) { - eventListeners.removeValueForKey(token) + eventListeners.removeValue(forKey: token) } } } public func unsubscribe(store: T, listenerToken: StoreListenerToken) { - eventListeners.removeValueForKey(listenerToken) + eventListeners.removeValue(forKey: listenerToken) } public func emitChange(store: T) { @@ -86,7 +87,7 @@ private class EventListener { let store: Store let handler: () -> () - init(store: Store, handler: () -> ()) { + init(store: Store, handler: @escaping () -> ()) { self.store = store self.handler = handler } diff --git a/SwiftFlux/Utils/ReduceStore.swift b/SwiftFlux/Utils/ReduceStore.swift index 8406a09..0d94d38 100644 --- a/SwiftFlux/Utils/ReduceStore.swift +++ b/SwiftFlux/Utils/ReduceStore.swift @@ -8,7 +8,7 @@ import Result -public class ReduceStore: StoreBase { +open class ReduceStore: StoreBase { public init(initialState: T) { self.initialState = initialState super.init() @@ -20,8 +20,8 @@ public class ReduceStore: StoreBase { return internalState ?? initialState } - public func reduce(type: A.Type, reducer: (T, Result) -> T) -> DispatchToken { - return self.register(type) { (result) in + public func reduce(type: A.Type, reducer: @escaping (T, Result) -> T) -> DispatchToken { + return self.register(type: type) { (result) in let startState = self.state self.internalState = reducer(self.state, result) if startState != self.state { diff --git a/SwiftFlux/Utils/StoreBase.swift b/SwiftFlux/Utils/StoreBase.swift index 1cdd044..125bedd 100644 --- a/SwiftFlux/Utils/StoreBase.swift +++ b/SwiftFlux/Utils/StoreBase.swift @@ -8,13 +8,13 @@ import Result -public class StoreBase: Store { +open class StoreBase: Store { private var dispatchTokens: [DispatchToken] = [] public init() {} - public func register(type: T.Type, handler: (Result) -> ()) -> DispatchToken { - let dispatchToken = ActionCreator.dispatcher.register(type) { (result) -> () in + public func register(type: T.Type, handler: @escaping (Result) -> ()) -> DispatchToken { + let dispatchToken = ActionCreator.dispatcher.register(type: type) { (result) -> () in handler(result) } dispatchTokens.append(dispatchToken) @@ -23,7 +23,7 @@ public class StoreBase: Store { public func unregister() { dispatchTokens.forEach { (dispatchToken) -> () in - ActionCreator.dispatcher.unregister(dispatchToken) + ActionCreator.dispatcher.unregister(dispatchToken: dispatchToken) } } } diff --git a/SwiftFluxTests/ActionCreatorSpec.swift b/SwiftFluxTests/ActionCreatorSpec.swift index 23bef1e..5895489 100644 --- a/SwiftFluxTests/ActionCreatorSpec.swift +++ b/SwiftFluxTests/ActionCreatorSpec.swift @@ -19,29 +19,27 @@ class ActionCreatorSpec: QuickSpec { struct ActionCreatorTestAction: Action { typealias Payload = ActionCreatorTestModel func invoke(dispatcher: Dispatcher) { - dispatcher.dispatch(self, result: Result(value: ActionCreatorTestModel(name: "test"))) + dispatcher.dispatch(action: self, result: Result(value: ActionCreatorTestModel(name: "test"))) } } struct ActionCreatorDefaultErrorAction: Action { typealias Payload = ActionCreatorTestModel func invoke(dispatcher: Dispatcher) { - dispatcher.dispatch(self, result: Result(error: NSError(domain: "TEST00000", code: -1, userInfo: [:]))) + dispatcher.dispatch(action: self, result: Result(error: NSError(domain: "TEST00000", code: -1, userInfo: [:]))) } } - enum ActionError: ErrorType { - case UnexpectedError(NSError) + enum ActionError: Error { + case unexpectedError(NSError) } struct ActionCreatorErrorAction: Action { typealias Payload = ActionCreatorTestModel typealias Error = ActionError func invoke(dispatcher: Dispatcher) { - let error = ActionError.UnexpectedError( - NSError(domain: "TEST00000", code: -1, userInfo: [:]) - ) - dispatcher.dispatch(self, result: Result(error: error)) + let error = NSError(domain: "TEST00000", code: -1, userInfo: [:]) + dispatcher.dispatch(action: self, result: Result(error: error)) } } @@ -56,28 +54,28 @@ class ActionCreatorSpec: QuickSpec { fails = [] callbacks = [] - let id1 = ActionCreator.dispatcher.register(ActionCreatorTestAction.self) { (result) in + let id1 = ActionCreator.dispatcher.register(type: ActionCreatorTestAction.self) { (result) in switch result { - case .Success(let box): + case .success(let box): results.append("\(box.name)1") - case .Failure(_): + case .failure(_): fails.append("fail1") } } - let id2 = ActionCreator.dispatcher.register(ActionCreatorErrorAction.self) { (result) in + let id2 = ActionCreator.dispatcher.register(type: ActionCreatorErrorAction.self) { (result) in switch result { - case .Success(let box): + case .success(let box): results.append("\(box.name)2") - case .Failure(let error): - fails.append("fail2 \(error.dynamicType)") + case .failure(let error): + fails.append("fail2 \(type(of: error))") } } - let id3 = ActionCreator.dispatcher.register(ActionCreatorDefaultErrorAction.self) { (result) in + let id3 = ActionCreator.dispatcher.register(type: ActionCreatorDefaultErrorAction.self) { (result) in switch result { - case .Success(let box): + case .success(let box): results.append("\(box.name)3") - case .Failure(let error): - fails.append("fail3 \(error.dynamicType)") + case .failure(let error): + fails.append("fail3 \(type(of: error))") } } callbacks.append(id1) @@ -87,14 +85,14 @@ class ActionCreatorSpec: QuickSpec { afterEach({ () -> () in for id in callbacks { - ActionCreator.dispatcher.unregister(id) + ActionCreator.dispatcher.unregister(dispatchToken: id) } }) context("when action succeeded") { it("should dispatch to registered callback handlers") { let action = ActionCreatorTestAction() - ActionCreator.invoke(action) + ActionCreator.invoke(action: action) expect(results.count).to(equal(1)) expect(fails.isEmpty).to(beTruthy()) @@ -105,18 +103,18 @@ class ActionCreatorSpec: QuickSpec { context("when action failed with error type") { it("should dispatch to registered callback handlers") { let action = ActionCreatorErrorAction() - ActionCreator.invoke(action) + ActionCreator.invoke(action: action) expect(fails.count).to(equal(1)) expect(results.isEmpty).to(beTruthy()) - expect(fails).to(contain("fail2 ActionError")) + expect(fails).to(contain("fail2 NSError")) } } context("when action failed") { it("should dispatch to registered callback handlers") { let action = ActionCreatorDefaultErrorAction() - ActionCreator.invoke(action) + ActionCreator.invoke(action: action) expect(fails.count).to(equal(1)) expect(results.isEmpty).to(beTruthy()) diff --git a/SwiftFluxTests/DispatcherSpec.swift b/SwiftFluxTests/DispatcherSpec.swift index a2abb7e..c60b04f 100644 --- a/SwiftFluxTests/DispatcherSpec.swift +++ b/SwiftFluxTests/DispatcherSpec.swift @@ -34,19 +34,19 @@ class DispatcherSpec: QuickSpec { fails = [] callbacks = [] - let id1 = dispatcher.register(DispatcherTestAction.self) { (result) in + let id1 = dispatcher.register(type: DispatcherTestAction.self) { (result) in switch result { - case .Success(let box): + case .success(let box): results.append("\(box.name)1") - case .Failure(_): + case .failure(_): fails.append("fail") } } - let id2 = dispatcher.register(DispatcherTestAction.self) { (result) in + let id2 = dispatcher.register(type: DispatcherTestAction.self) { (result) in switch result { - case .Success(let box): + case .success(let box): results.append("\(box.name)2") - case .Failure(_): + case .failure(_): fails.append("fail") } } @@ -56,13 +56,13 @@ class DispatcherSpec: QuickSpec { afterEach { () in for id in callbacks { - dispatcher.unregister(id) + dispatcher.unregister(dispatchToken: id) } } context("when action succeeded") { it("should dispatch to registered callback handlers") { - dispatcher.dispatch(DispatcherTestAction(), result: Result(value: DispatcherTestModel(name: "test"))) + dispatcher.dispatch(action: DispatcherTestAction(), result: Result(value: DispatcherTestModel(name: "test"))) expect(results.count).to(equal(2)) expect(fails.isEmpty).to(beTruthy()) expect(results).to(contain("test1", "test2")) @@ -71,7 +71,7 @@ class DispatcherSpec: QuickSpec { context("when action failed") { it("should dispatch to registered callback handlers") { - dispatcher.dispatch(DispatcherTestAction(), result: Result(error: NSError(domain: "TEST0000", code: -1, userInfo: [:]))) + dispatcher.dispatch(action: DispatcherTestAction(), result: Result(error: NSError(domain: "TEST0000", code: -1, userInfo: [:]))) expect(fails.count).to(equal(2)) expect(results.isEmpty).to(beTruthy()) } @@ -89,27 +89,27 @@ class DispatcherSpec: QuickSpec { results = [] callbacks = [] - id1 = dispatcher.register(DispatcherTestAction.self) { (result) in + id1 = dispatcher.register(type: DispatcherTestAction.self) { (result) in switch result { - case .Success(let box): - dispatcher.waitFor([id2], type: DispatcherTestAction.self, result: result) + case .success(let box): + dispatcher.waitFor(dispatchTokens: [id2], type: DispatcherTestAction.self, result: result) results.append("\(box.name)1") default: break } } - id2 = dispatcher.register(DispatcherTestAction.self) { (result) in + id2 = dispatcher.register(type: DispatcherTestAction.self) { (result) in switch result { - case .Success(let box): - dispatcher.waitFor([id3], type: DispatcherTestAction.self, result: result) + case .success(let box): + dispatcher.waitFor(dispatchTokens: [id3], type: DispatcherTestAction.self, result: result) results.append("\(box.name)2") default: break } } - id3 = dispatcher.register(DispatcherTestAction.self) { (result) in + id3 = dispatcher.register(type: DispatcherTestAction.self) { (result) in switch result { - case .Success(let box): + case .success(let box): results.append("\(box.name)3") default: break @@ -122,12 +122,12 @@ class DispatcherSpec: QuickSpec { afterEach { () in for id in callbacks { - dispatcher.unregister(id) + dispatcher.unregister(dispatchToken: id) } } it("should wait for invoke callback") { - dispatcher.dispatch(DispatcherTestAction(), result: Result(value: DispatcherTestModel(name: "test"))) + dispatcher.dispatch(action: DispatcherTestAction(), result: Result(value: DispatcherTestModel(name: "test"))) expect(results.count).to(equal(3)) expect(results[0]).to(equal("test3")) expect(results[1]).to(equal("test2")) diff --git a/SwiftFluxTests/StoreSpec.swift b/SwiftFluxTests/StoreSpec.swift index 172b79e..0fe69ea 100644 --- a/SwiftFluxTests/StoreSpec.swift +++ b/SwiftFluxTests/StoreSpec.swift @@ -24,12 +24,12 @@ class StoreSpec: QuickSpec { beforeEach { () in results = [] - store1.subscribe { () in + let _ = store1.subscribe(store: store1, handler: { results.append("store1") - } - store2.subscribe { () in + }) + let _ = store2.subscribe(store: store2, handler: { results.append("store2") - } + }) } afterEach { () in @@ -58,9 +58,9 @@ class StoreSpec: QuickSpec { beforeEach { () in results = [] - token = store1.subscribe { () in + token = store1.subscribe(store: store1, handler: { results.append("store1") - } + }) } afterEach { () in @@ -75,7 +75,7 @@ class StoreSpec: QuickSpec { results = [] - store1.unsubscribe(token) + store1.unsubscribe(listenerToken: token) store1.emitChange() expect(results.count).to(equal(0)) expect(results).toNot(contain("store1")) diff --git a/SwiftFluxTests/Utils/ReduceStoreSpec.swift b/SwiftFluxTests/Utils/ReduceStoreSpec.swift index b250aed..e0836f5 100644 --- a/SwiftFluxTests/Utils/ReduceStoreSpec.swift +++ b/SwiftFluxTests/Utils/ReduceStoreSpec.swift @@ -1,3 +1,4 @@ + // // ReduceStoreSpec.swift // SwiftFlux @@ -17,14 +18,14 @@ class ReduceStoreSpec: QuickSpec { typealias Payload = Int let number: Int func invoke(dispatcher: Dispatcher) { - dispatcher.dispatch(self, result: Result(value: number)) + dispatcher.dispatch(action: self, result: Result(value: number)) } } struct Minus: Action { typealias Payload = Int let number: Int func invoke(dispatcher: Dispatcher) { - dispatcher.dispatch(self, result: Result(value: number)) + dispatcher.dispatch(action: self, result: Result(value: number)) } } } @@ -33,16 +34,16 @@ class ReduceStoreSpec: QuickSpec { init() { super.init(initialState: 0) - self.reduce(CalculateActions.Plus.self) { (state, result) -> Int in + let _ = self.reduce(type: CalculateActions.Plus.self) { (state, result) -> Int in switch result { - case .Success(let number): return state + number + case .success(let number): return state + number default: return state } } - self.reduce(CalculateActions.Minus.self) { (state, result) -> Int in + let _ = self.reduce(type: CalculateActions.Minus.self) { (state, result) -> Int in switch result { - case .Success(let number): return state - number + case .success(let number): return state - number default: return state } } @@ -55,9 +56,9 @@ class ReduceStoreSpec: QuickSpec { beforeEach { () -> () in results = [] - store.subscribe { () -> () in + let _ = store.subscribe(store: store, handler: { results.append(store.state) - } + }) } afterEach({ () -> () in @@ -65,10 +66,10 @@ class ReduceStoreSpec: QuickSpec { }) it("should calculate state with number") { - ActionCreator.invoke(CalculateActions.Plus(number: 3)) - ActionCreator.invoke(CalculateActions.Plus(number: 3)) - ActionCreator.invoke(CalculateActions.Minus(number: 2)) - ActionCreator.invoke(CalculateActions.Minus(number: 1)) + ActionCreator.invoke(action: CalculateActions.Plus(number: 3)) + ActionCreator.invoke(action: CalculateActions.Plus(number: 3)) + ActionCreator.invoke(action: CalculateActions.Minus(number: 2)) + ActionCreator.invoke(action: CalculateActions.Minus(number: 1)) expect(results.count).to(equal(4)) expect(results[0]).to(equal(3)) diff --git a/SwiftFluxTests/Utils/StoreBaseSpec.swift b/SwiftFluxTests/Utils/StoreBaseSpec.swift index 3cf24ee..a96a9a5 100644 --- a/SwiftFluxTests/Utils/StoreBaseSpec.swift +++ b/SwiftFluxTests/Utils/StoreBaseSpec.swift @@ -18,14 +18,14 @@ class StoreBaseSpec: QuickSpec { typealias Payload = Int let number: Int func invoke(dispatcher: Dispatcher) { - dispatcher.dispatch(self, result: Result(value: number)) + dispatcher.dispatch(action: self, result: Result(value: number)) } } struct Minus: Action { typealias Payload = Int let number: Int func invoke(dispatcher: Dispatcher) { - dispatcher.dispatch(self, result: Result(value: number)) + dispatcher.dispatch(action: self, result: Result(value: number)) } } } @@ -36,9 +36,9 @@ class StoreBaseSpec: QuickSpec { override init() { super.init() - self.register(CalculateActions.Plus.self) { (result) in + let _ = self.register(type: CalculateActions.Plus.self) { (result) in switch result { - case .Success(let value): + case .success(let value): self.number += value self.emitChange() default: @@ -46,9 +46,9 @@ class StoreBaseSpec: QuickSpec { } } - self.register(CalculateActions.Minus.self) { (result) in + let _ = self.register(type: CalculateActions.Minus.self) { (result) in switch result { - case .Success(let value): + case .success(let value): self.number -= value self.emitChange() default: @@ -64,9 +64,9 @@ class StoreBaseSpec: QuickSpec { beforeEach { () in results = [] - store.subscribe { () in + let _ = store.subscribe(store: store, handler: { results.append(store.number) - } + }) } afterEach { () in @@ -74,10 +74,10 @@ class StoreBaseSpec: QuickSpec { } it("should calculate state with number") { - ActionCreator.invoke(CalculateActions.Plus(number: 3)) - ActionCreator.invoke(CalculateActions.Plus(number: 3)) - ActionCreator.invoke(CalculateActions.Minus(number: 2)) - ActionCreator.invoke(CalculateActions.Minus(number: 1)) + ActionCreator.invoke(action: CalculateActions.Plus(number: 3)) + ActionCreator.invoke(action: CalculateActions.Plus(number: 3)) + ActionCreator.invoke(action: CalculateActions.Minus(number: 2)) + ActionCreator.invoke(action: CalculateActions.Minus(number: 1)) expect(results.count).to(equal(4)) expect(results[0]).to(equal(3)) From 2c467189d76e4cfea0a64dd0b2b0e69285ea306d Mon Sep 17 00:00:00 2001 From: Jubin Jacob Date: Mon, 19 Dec 2016 10:04:38 +0530 Subject: [PATCH 2/4] removed legacy swift version from watch os target --- SwiftFlux.xcodeproj/project.pbxproj | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/SwiftFlux.xcodeproj/project.pbxproj b/SwiftFlux.xcodeproj/project.pbxproj index afc8e95..9644c2e 100644 --- a/SwiftFlux.xcodeproj/project.pbxproj +++ b/SwiftFlux.xcodeproj/project.pbxproj @@ -135,21 +135,21 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - CA1C3FEA1B7919390048126F /* ActionCreatorSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionCreatorSpec.swift; sourceTree = ""; }; + CA1C3FEA1B7919390048126F /* ActionCreatorSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ActionCreatorSpec.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CA3159FB1B6D2FB5004A8F2C /* SwiftFlux.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftFlux.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CA315A051B6D2FB5004A8F2C /* SwiftFluxTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftFluxTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; CA70C3541BFF82AA00EABF70 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; - CA7C53FE1B6DF17300F393CB /* StoreSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreSpec.swift; sourceTree = ""; }; + CA7C53FE1B6DF17300F393CB /* StoreSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = StoreSpec.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CACA8E391B6CD85F00F051B8 /* DemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; CACA8E3C1B6CD85F00F051B8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; CACA8E3D1B6CD85F00F051B8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - CACA8E3F1B6CD85F00F051B8 /* TodoListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodoListViewController.swift; sourceTree = ""; }; + CACA8E3F1B6CD85F00F051B8 /* TodoListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = TodoListViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CACA8E421B6CD85F00F051B8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; CACA8E441B6CD85F00F051B8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; CACA8E471B6CD85F00F051B8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; CACA8E681B6CD91200F051B8 /* TodoAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodoAction.swift; sourceTree = ""; }; CACA8E6B1B6CD93E00F051B8 /* Todo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Todo.swift; sourceTree = ""; }; - CACA8E6D1B6CD95600F051B8 /* TodoStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodoStore.swift; sourceTree = ""; }; + CACA8E6D1B6CD95600F051B8 /* TodoStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = TodoStore.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CACC47F51B6B9DDA00FDF2BF /* SwiftFlux.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftFlux.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CACC47F91B6B9DDA00FDF2BF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; CACC47FA1B6B9DDA00FDF2BF /* SwiftFlux.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftFlux.h; sourceTree = ""; }; @@ -157,18 +157,18 @@ CACC48061B6B9DDA00FDF2BF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; CACC48111B6B9E4900FDF2BF /* Dispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dispatcher.swift; sourceTree = ""; }; CACC48131B6B9E8000FDF2BF /* Action.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Action.swift; sourceTree = ""; }; - CACC48151B6BA00D00FDF2BF /* Store.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Store.swift; sourceTree = ""; }; + CACC48151B6BA00D00FDF2BF /* Store.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Store.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CAEAF03B1BFB97DF0021CC66 /* ReduceStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReduceStore.swift; sourceTree = ""; }; - CAEAF03E1BFBA4EB0021CC66 /* ReduceStoreSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReduceStoreSpec.swift; sourceTree = ""; }; + CAEAF03E1BFBA4EB0021CC66 /* ReduceStoreSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ReduceStoreSpec.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CAEF56D21B6D36D3005684E2 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Quick.framework; sourceTree = ""; }; CAEF56D31B6D36D3005684E2 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; CAEF56D71B6D36D3005684E2 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Quick.framework; sourceTree = ""; }; CAEF56D81B6D36D3005684E2 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; }; CAEF5DB01B6D3927005684E2 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = ""; }; CAEF5DB51B6D3951005684E2 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = ""; }; - CAEF5DBA1B6D3989005684E2 /* DispatcherSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatcherSpec.swift; sourceTree = ""; }; + CAEF5DBA1B6D3989005684E2 /* DispatcherSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DispatcherSpec.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CAFDEA161BFF59E000AF7A09 /* StoreBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreBase.swift; sourceTree = ""; }; - CAFDEA191BFF5D4E00AF7A09 /* StoreBaseSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreBaseSpec.swift; sourceTree = ""; }; + CAFDEA191BFF5D4E00AF7A09 /* StoreBaseSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = StoreBaseSpec.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CAFDEA1D1BFF64F700AF7A09 /* CreateTodoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateTodoViewController.swift; sourceTree = ""; }; CAFDEA241BFF749B00AF7A09 /* SwiftFlux.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftFlux.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -1133,7 +1133,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; @@ -1156,7 +1156,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0.1; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; From 9f123087de2b511fb5d0fa3a48afe2f6a5ebc4a9 Mon Sep 17 00:00:00 2001 From: Jubin Jacob Date: Mon, 19 Dec 2016 11:45:28 +0530 Subject: [PATCH 3/4] made all swift versions 3.0 --- SwiftFlux.xcodeproj/project.pbxproj | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/SwiftFlux.xcodeproj/project.pbxproj b/SwiftFlux.xcodeproj/project.pbxproj index 9644c2e..10f7282 100644 --- a/SwiftFlux.xcodeproj/project.pbxproj +++ b/SwiftFlux.xcodeproj/project.pbxproj @@ -796,7 +796,7 @@ SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; VALID_ARCHS = "i386 x86_64"; }; name = Debug; @@ -824,7 +824,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; VALID_ARCHS = "i386 x86_64"; }; name = Release; @@ -853,7 +853,7 @@ PRODUCT_NAME = SwiftFluxTests; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; VALID_ARCHS = "i386 x86_64"; }; name = Debug; @@ -876,7 +876,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = SwiftFluxTests; SDKROOT = macosx; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; VALID_ARCHS = "i386 x86_64"; }; name = Release; @@ -967,7 +967,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; @@ -1013,7 +1013,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VALID_ARCHS = "arm64 armv7 armv7s"; @@ -1046,7 +1046,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1073,7 +1073,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -1094,7 +1094,7 @@ LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = SwiftFluxTests; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1111,7 +1111,7 @@ LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = "jp.mog2dev.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = SwiftFluxTests; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -1133,7 +1133,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; @@ -1156,7 +1156,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; From 17c9ea6318341fe8fb50f099f5f14c17e8ca2618 Mon Sep 17 00:00:00 2001 From: jubinjacob19 Date: Wed, 21 Jun 2017 07:05:07 +0530 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8bf4e11..2090558 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ It provides concept of "one-way data flow" with **type-safe** modules by Swift l # Requirements -- Swift 2.2 or later +- Swift 3 or later - iOS 8.0 or later - Mac OS 10.9 or later - watch OS 2.0 or later