From 6c6191e9b0f707552b9323c7a46592975969807d Mon Sep 17 00:00:00 2001 From: Vitalii Parovishnyk Date: Wed, 2 Oct 2019 09:48:44 +0300 Subject: [PATCH 1/2] added swift package updated example to 5.0 --- Package.swift | 22 ++++++++++++++++++++++ Sample/AppDelegate.swift | 4 ++-- Sample/ViewController.swift | 2 +- SwiftEventBus.xcodeproj/project.pbxproj | 9 +++------ 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 Package.swift diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..66ad16c --- /dev/null +++ b/Package.swift @@ -0,0 +1,22 @@ +// swift-tools-version:5.0 + +import PackageDescription + +let package = Package( + name: "SwiftEventBus", + products: [ + .library( + name: "SwiftEventBus", + targets: ["SwiftEventBus"] + ) + ], + dependencies: [], + targets: [SwiftEventBus + .target( + name: "SwiftEventBus", + dependencies: [], + path: "SwiftEventBus" + ), + ], + swiftLanguageVersions: [.v5] +) diff --git a/Sample/AppDelegate.swift b/Sample/AppDelegate.swift index ea2bbb2..4c67c28 100644 --- a/Sample/AppDelegate.swift +++ b/Sample/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]? = nil) -> Bool { // Override point for customization after application launch. self.subscribeToServices() @@ -22,7 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func subscribeToServices() { - LoginService.init() + let _ = LoginService.init() // todo - rest of the services } diff --git a/Sample/ViewController.swift b/Sample/ViewController.swift index 685528c..c43bf72 100644 --- a/Sample/ViewController.swift +++ b/Sample/ViewController.swift @@ -20,7 +20,7 @@ class ViewController: UIViewController { SwiftEventBus.onMainThread(self, name: "login") { result in - let p : Person = result.object as! Person + let p : Person = result?.object as! Person self.welcomeLabel.text = "Welcome \(p.name)" diff --git a/SwiftEventBus.xcodeproj/project.pbxproj b/SwiftEventBus.xcodeproj/project.pbxproj index 370eb06..9519281 100644 --- a/SwiftEventBus.xcodeproj/project.pbxproj +++ b/SwiftEventBus.xcodeproj/project.pbxproj @@ -169,10 +169,9 @@ }; buildConfigurationList = DBCE8D441D8DD5160012B477 /* Build configuration list for PBXProject "SwiftEventBus" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, ); @@ -306,6 +305,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -361,6 +361,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -386,7 +387,6 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -407,7 +407,6 @@ PRODUCT_BUNDLE_IDENTIFIER = cesarferreira.SwiftEventBus; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; }; name = Release; }; @@ -420,7 +419,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = cesarferreira.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -433,7 +431,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = cesarferreira.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; }; name = Release; }; From b0cce4977fc0e23da1004446d7ec6f7f9706f1d5 Mon Sep 17 00:00:00 2001 From: Vitalii Parovishnyk Date: Wed, 2 Oct 2019 10:06:58 +0300 Subject: [PATCH 2/2] updated swift package --- Package.swift | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/Package.swift b/Package.swift index 66ad16c..a4704a2 100644 --- a/Package.swift +++ b/Package.swift @@ -2,21 +2,15 @@ import PackageDescription -let package = Package( - name: "SwiftEventBus", - products: [ - .library( - name: "SwiftEventBus", - targets: ["SwiftEventBus"] - ) - ], - dependencies: [], - targets: [SwiftEventBus - .target( - name: "SwiftEventBus", - dependencies: [], - path: "SwiftEventBus" - ), - ], - swiftLanguageVersions: [.v5] +let package = Package(name: "SwiftEventBus", + platforms: [.macOS(.v10_10), + .iOS(.v8)], + + products: [.library(name: "SwiftEventBus", + targets: ["SwiftEventBus"])], + + targets: [.target(name: "SwiftEventBus", + path: "SwiftEventBus")], + + swiftLanguageVersions: [.v5] )