From 5e9eeda84a40116e85ba4e52e1711246d98982e0 Mon Sep 17 00:00:00 2001 From: Merrick Sapsford Date: Thu, 8 Jun 2017 10:45:00 +0100 Subject: [PATCH 1/8] Convert to Swift 4 --- Example/Listenable-Example.xcodeproj/project.pbxproj | 7 +++++-- Sources/Listenable.xcodeproj/project.pbxproj | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Example/Listenable-Example.xcodeproj/project.pbxproj b/Example/Listenable-Example.xcodeproj/project.pbxproj index 37dad7f..e4bcd89 100644 --- a/Example/Listenable-Example.xcodeproj/project.pbxproj +++ b/Example/Listenable-Example.xcodeproj/project.pbxproj @@ -164,6 +164,7 @@ TargetAttributes = { D6F613D51E24F632004884E8 = { CreatedOnToolsVersion = 8.2; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; }; @@ -368,7 +369,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.msapsford.Listenable-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -381,7 +383,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.msapsford.Listenable-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Sources/Listenable.xcodeproj/project.pbxproj b/Sources/Listenable.xcodeproj/project.pbxproj index 2c4ec90..4e045dc 100644 --- a/Sources/Listenable.xcodeproj/project.pbxproj +++ b/Sources/Listenable.xcodeproj/project.pbxproj @@ -171,7 +171,7 @@ TargetAttributes = { D6F613B01E24F59D004884E8 = { CreatedOnToolsVersion = 8.2; - LastSwiftMigration = 0820; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; D6F613B91E24F59D004884E8 = { @@ -374,7 +374,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -393,7 +394,8 @@ PRODUCT_BUNDLE_IDENTIFIER = com.msapsford.Listenable; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.0; }; name = Release; }; From 313ab98ea361b905fafa18c34338109f59d03143 Mon Sep 17 00:00:00 2001 From: Merrick Sapsford Date: Thu, 27 Jul 2017 11:33:03 +0100 Subject: [PATCH 2/8] Update build script --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f38353b..8ad8f87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: objective-c -osx_image: xcode8.2 +osx_image: xcode9 script: - - xcodebuild -workspace Listenable.xcworkspace -scheme Listenable -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.0' build test + - xcodebuild -workspace Listenable.xcworkspace -scheme Listenable -destination 'platform=iOS Simulator,name=iPhone 7,OS=11.0' build test deploy: provider: script From a05b4a212d6b0f7f08bffa7a4be0222fdb9e9121 Mon Sep 17 00:00:00 2001 From: Merrick Sapsford Date: Thu, 27 Jul 2017 11:34:30 +0100 Subject: [PATCH 3/8] Remove AnyObject inheritance --- Sources/Listenable/Listenable.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Listenable/Listenable.swift b/Sources/Listenable/Listenable.swift index 977943a..3f28032 100644 --- a/Sources/Listenable/Listenable.swift +++ b/Sources/Listenable/Listenable.swift @@ -9,7 +9,7 @@ import Foundation /// An object which can have a number of listeners for delegation. -open class Listenable: AnyObject { +open class Listenable { // MARK: Closures From d6321ec3d72e28042c54b559dd73ce4e752d63fe Mon Sep 17 00:00:00 2001 From: Merrick Sapsford Date: Thu, 27 Jul 2017 11:40:24 +0100 Subject: [PATCH 4/8] Replace example project with playground --- .travis.yml | 6 - .../project.pbxproj | 415 ------------------ .../contents.xcworkspacedata | 7 - .../xcschemes/Listenable-Example.xcscheme | 91 ---- Example/Listenable-Example/AppDelegate.swift | 46 -- .../Base.lproj/Main.storyboard | 46 -- Example/Listenable-Example/Info.plist | 38 -- .../Listenable-Example/ListenableObject.swift | 27 -- .../Listenable-Example/ListenerButton.swift | 19 - .../ListenerViewController.swift | 39 -- .../AppIcon.appiconset/Contents.json | 38 -- .../Resource/LaunchScreen.storyboard | 27 -- Listenable Example.playground/Contents.swift | 5 + .../contents.xcplayground | 4 + .../contents.xcworkspacedata | 2 +- scripts/push.sh | 3 - 16 files changed, 10 insertions(+), 803 deletions(-) delete mode 100644 Example/Listenable-Example.xcodeproj/project.pbxproj delete mode 100644 Example/Listenable-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 Example/Listenable-Example.xcodeproj/xcshareddata/xcschemes/Listenable-Example.xcscheme delete mode 100644 Example/Listenable-Example/AppDelegate.swift delete mode 100644 Example/Listenable-Example/Base.lproj/Main.storyboard delete mode 100644 Example/Listenable-Example/Info.plist delete mode 100644 Example/Listenable-Example/ListenableObject.swift delete mode 100644 Example/Listenable-Example/ListenerButton.swift delete mode 100644 Example/Listenable-Example/ListenerViewController.swift delete mode 100644 Example/Listenable-Example/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 Example/Listenable-Example/Resource/LaunchScreen.storyboard create mode 100644 Listenable Example.playground/Contents.swift create mode 100644 Listenable Example.playground/contents.xcplayground delete mode 100644 scripts/push.sh diff --git a/.travis.yml b/.travis.yml index 8ad8f87..5c630e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,5 @@ osx_image: xcode9 script: - xcodebuild -workspace Listenable.xcworkspace -scheme Listenable -destination 'platform=iOS Simulator,name=iPhone 7,OS=11.0' build test -deploy: - provider: script - script: ./scripts/push.sh - on: - tags: true - after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/Example/Listenable-Example.xcodeproj/project.pbxproj b/Example/Listenable-Example.xcodeproj/project.pbxproj deleted file mode 100644 index e4bcd89..0000000 --- a/Example/Listenable-Example.xcodeproj/project.pbxproj +++ /dev/null @@ -1,415 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - D6465F521E24FBE9004E8623 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D6465F501E24FBE9004E8623 /* Assets.xcassets */; }; - D6465F531E24FBE9004E8623 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6465F511E24FBE9004E8623 /* LaunchScreen.storyboard */; }; - D6465F551E24FC57004E8623 /* ListenableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6465F541E24FC57004E8623 /* ListenableObject.swift */; }; - D6465F571E24FE5F004E8623 /* ListenerButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6465F561E24FE5F004E8623 /* ListenerButton.swift */; }; - D6E73A741E51FF0E00A8D5A5 /* Listenable.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 46F1E2DA1E33D0E200E83B5B /* Listenable.framework */; }; - D6E73A751E51FF0E00A8D5A5 /* Listenable.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 46F1E2DA1E33D0E200E83B5B /* Listenable.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - D6F613DA1E24F632004884E8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F613D91E24F632004884E8 /* AppDelegate.swift */; }; - D6F613DC1E24F632004884E8 /* ListenerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F613DB1E24F632004884E8 /* ListenerViewController.swift */; }; - D6F613DF1E24F632004884E8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6F613DD1E24F632004884E8 /* Main.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 46F1E2D91E33D0E200E83B5B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46F1E2D41E33D0E200E83B5B /* Listenable.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = D6F613B11E24F59D004884E8; - remoteInfo = Listenable; - }; - 46F1E2DB1E33D0E200E83B5B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46F1E2D41E33D0E200E83B5B /* Listenable.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = D6F613BA1E24F59D004884E8; - remoteInfo = ListenableTests; - }; - D6E73A761E51FF0E00A8D5A5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46F1E2D41E33D0E200E83B5B /* Listenable.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = D6F613B01E24F59D004884E8; - remoteInfo = Listenable; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - D6E73A781E51FF0E00A8D5A5 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - D6E73A751E51FF0E00A8D5A5 /* Listenable.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 46F1E2D41E33D0E200E83B5B /* Listenable.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Listenable.xcodeproj; path = ../Sources/Listenable.xcodeproj; sourceTree = ""; }; - D6465F501E24FBE9004E8623 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - D6465F511E24FBE9004E8623 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; - D6465F541E24FC57004E8623 /* ListenableObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListenableObject.swift; sourceTree = ""; }; - D6465F561E24FE5F004E8623 /* ListenerButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListenerButton.swift; sourceTree = ""; }; - D6F613D61E24F632004884E8 /* Listenable-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Listenable-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - D6F613D91E24F632004884E8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - D6F613DB1E24F632004884E8 /* ListenerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListenerViewController.swift; sourceTree = ""; }; - D6F613DE1E24F632004884E8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - D6F613E51E24F632004884E8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - D6F613D31E24F632004884E8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D6E73A741E51FF0E00A8D5A5 /* Listenable.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 46F1E2D51E33D0E200E83B5B /* Products */ = { - isa = PBXGroup; - children = ( - 46F1E2DA1E33D0E200E83B5B /* Listenable.framework */, - 46F1E2DC1E33D0E200E83B5B /* ListenableTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - D6465F4F1E24FBE9004E8623 /* Resource */ = { - isa = PBXGroup; - children = ( - D6F613E51E24F632004884E8 /* Info.plist */, - D6465F501E24FBE9004E8623 /* Assets.xcassets */, - D6465F511E24FBE9004E8623 /* LaunchScreen.storyboard */, - ); - path = Resource; - sourceTree = ""; - }; - D6F613CD1E24F632004884E8 = { - isa = PBXGroup; - children = ( - 46F1E2D41E33D0E200E83B5B /* Listenable.xcodeproj */, - D6F613D81E24F632004884E8 /* Listenable-Example */, - D6F613D71E24F632004884E8 /* Products */, - ); - sourceTree = ""; - }; - D6F613D71E24F632004884E8 /* Products */ = { - isa = PBXGroup; - children = ( - D6F613D61E24F632004884E8 /* Listenable-Example.app */, - ); - name = Products; - sourceTree = ""; - }; - D6F613D81E24F632004884E8 /* Listenable-Example */ = { - isa = PBXGroup; - children = ( - D6F613D91E24F632004884E8 /* AppDelegate.swift */, - D6F613DB1E24F632004884E8 /* ListenerViewController.swift */, - D6465F561E24FE5F004E8623 /* ListenerButton.swift */, - D6465F541E24FC57004E8623 /* ListenableObject.swift */, - D6F613DD1E24F632004884E8 /* Main.storyboard */, - D6465F4F1E24FBE9004E8623 /* Resource */, - ); - path = "Listenable-Example"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - D6F613D51E24F632004884E8 /* Listenable-Example */ = { - isa = PBXNativeTarget; - buildConfigurationList = D6F613E81E24F632004884E8 /* Build configuration list for PBXNativeTarget "Listenable-Example" */; - buildPhases = ( - D6F613D21E24F632004884E8 /* Sources */, - D6F613D31E24F632004884E8 /* Frameworks */, - D6F613D41E24F632004884E8 /* Resources */, - D6E73A781E51FF0E00A8D5A5 /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - D6E73A771E51FF0E00A8D5A5 /* PBXTargetDependency */, - ); - name = "Listenable-Example"; - productName = "Listenable-Example"; - productReference = D6F613D61E24F632004884E8 /* Listenable-Example.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - D6F613CE1E24F632004884E8 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0900; - ORGANIZATIONNAME = "Merrick Sapsford"; - TargetAttributes = { - D6F613D51E24F632004884E8 = { - CreatedOnToolsVersion = 8.2; - LastSwiftMigration = 0900; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = D6F613D11E24F632004884E8 /* Build configuration list for PBXProject "Listenable-Example" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = D6F613CD1E24F632004884E8; - productRefGroup = D6F613D71E24F632004884E8 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 46F1E2D51E33D0E200E83B5B /* Products */; - ProjectRef = 46F1E2D41E33D0E200E83B5B /* Listenable.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - D6F613D51E24F632004884E8 /* Listenable-Example */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 46F1E2DA1E33D0E200E83B5B /* Listenable.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = Listenable.framework; - remoteRef = 46F1E2D91E33D0E200E83B5B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 46F1E2DC1E33D0E200E83B5B /* ListenableTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = ListenableTests.xctest; - remoteRef = 46F1E2DB1E33D0E200E83B5B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - D6F613D41E24F632004884E8 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D6465F521E24FBE9004E8623 /* Assets.xcassets in Resources */, - D6465F531E24FBE9004E8623 /* LaunchScreen.storyboard in Resources */, - D6F613DF1E24F632004884E8 /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - D6F613D21E24F632004884E8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D6F613DC1E24F632004884E8 /* ListenerViewController.swift in Sources */, - D6465F571E24FE5F004E8623 /* ListenerButton.swift in Sources */, - D6465F551E24FC57004E8623 /* ListenableObject.swift in Sources */, - D6F613DA1E24F632004884E8 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - D6E73A771E51FF0E00A8D5A5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Listenable; - targetProxy = D6E73A761E51FF0E00A8D5A5 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - D6F613DD1E24F632004884E8 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - D6F613DE1E24F632004884E8 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - D6F613E61E24F632004884E8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - D6F613E71E24F632004884E8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - D6F613E91E24F632004884E8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = "Listenable-Example/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.msapsford.Listenable-Example"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; - }; - name = Debug; - }; - D6F613EA1E24F632004884E8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = "Listenable-Example/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.msapsford.Listenable-Example"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - D6F613D11E24F632004884E8 /* Build configuration list for PBXProject "Listenable-Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D6F613E61E24F632004884E8 /* Debug */, - D6F613E71E24F632004884E8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D6F613E81E24F632004884E8 /* Build configuration list for PBXNativeTarget "Listenable-Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D6F613E91E24F632004884E8 /* Debug */, - D6F613EA1E24F632004884E8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = D6F613CE1E24F632004884E8 /* Project object */; -} diff --git a/Example/Listenable-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/Listenable-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7574144..0000000 --- a/Example/Listenable-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Example/Listenable-Example.xcodeproj/xcshareddata/xcschemes/Listenable-Example.xcscheme b/Example/Listenable-Example.xcodeproj/xcshareddata/xcschemes/Listenable-Example.xcscheme deleted file mode 100644 index 30e29f5..0000000 --- a/Example/Listenable-Example.xcodeproj/xcshareddata/xcschemes/Listenable-Example.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/Listenable-Example/AppDelegate.swift b/Example/Listenable-Example/AppDelegate.swift deleted file mode 100644 index 495da96..0000000 --- a/Example/Listenable-Example/AppDelegate.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// AppDelegate.swift -// Listenable-Example -// -// Created by Merrick Sapsford on 10/01/2017. -// Copyright © 2017 Merrick Sapsford. All rights reserved. -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. - return true - } - - func applicationWillResignActive(_ application: UIApplication) { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(_ application: UIApplication) { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - } - - func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(_ application: UIApplication) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - } - - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } - - -} - diff --git a/Example/Listenable-Example/Base.lproj/Main.storyboard b/Example/Listenable-Example/Base.lproj/Main.storyboard deleted file mode 100644 index a157fc8..0000000 --- a/Example/Listenable-Example/Base.lproj/Main.storyboard +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/Listenable-Example/Info.plist b/Example/Listenable-Example/Info.plist deleted file mode 100644 index 38e98af..0000000 --- a/Example/Listenable-Example/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/Example/Listenable-Example/ListenableObject.swift b/Example/Listenable-Example/ListenableObject.swift deleted file mode 100644 index 3cee820..0000000 --- a/Example/Listenable-Example/ListenableObject.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// ListenableObject.swift -// Listenable-Example -// -// Created by Merrick Sapsford on 10/01/2017. -// Copyright © 2017 Merrick Sapsford. All rights reserved. -// - -import Foundation -import Listenable - -protocol ListenableObjectDelegate { - - func listenableObjectDidProvideUpdate(_ listenableObject: ListenableObject) -} - -class ListenableObject: Listenable { - - - /// Calls listenableObjectDidProvideUpdate on all registered listeners. - func updateAllListeners() { - - self.updateListeners(withPriority: .high) { (listener, index) in - listener.listenableObjectDidProvideUpdate(self) - } - } -} diff --git a/Example/Listenable-Example/ListenerButton.swift b/Example/Listenable-Example/ListenerButton.swift deleted file mode 100644 index 33bd8c5..0000000 --- a/Example/Listenable-Example/ListenerButton.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// ListenerButton.swift -// Listenable-Example -// -// Created by Merrick Sapsford on 10/01/2017. -// Copyright © 2017 Merrick Sapsford. All rights reserved. -// - -import UIKit - -class ListenerButton: UIButton, ListenableObjectDelegate { - - // MARK: ListenableObjectDelegate - - func listenableObjectDidProvideUpdate(_ listenableObject: ListenableObject) { - print("ListenerButton - listener update received") - } - -} diff --git a/Example/Listenable-Example/ListenerViewController.swift b/Example/Listenable-Example/ListenerViewController.swift deleted file mode 100644 index b10912f..0000000 --- a/Example/Listenable-Example/ListenerViewController.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// ListenerViewController.swift -// Listenable-Example -// -// Created by Merrick Sapsford on 10/01/2017. -// Copyright © 2017 Merrick Sapsford. All rights reserved. -// - -import UIKit - -class ListenerViewController: UIViewController, ListenableObjectDelegate { - - // MARK: Properties - - let listenableObject = ListenableObject() - - @IBOutlet weak var actionButton: ListenerButton! - - // MARK: Lifecycle - - override func viewDidLoad() { - super.viewDidLoad() - - self.listenableObject.add(listeners: [self, self.actionButton], priority: .high) - } - - // MARK: Actions - - @IBAction func actionButtonPressed(_ sender: UIButton) { - self.listenableObject.updateAllListeners() - } - - // MARK: ListenableObjectDelegate - - func listenableObjectDidProvideUpdate(_ listenableObject: ListenableObject) { - print("ListenerViewController - listener update received") - } -} - diff --git a/Example/Listenable-Example/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Listenable-Example/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f..0000000 --- a/Example/Listenable-Example/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/Listenable-Example/Resource/LaunchScreen.storyboard b/Example/Listenable-Example/Resource/LaunchScreen.storyboard deleted file mode 100644 index fdf3f97..0000000 --- a/Example/Listenable-Example/Resource/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Listenable Example.playground/Contents.swift b/Listenable Example.playground/Contents.swift new file mode 100644 index 0000000..c9a6742 --- /dev/null +++ b/Listenable Example.playground/Contents.swift @@ -0,0 +1,5 @@ +//: Playground - noun: a place where people can play + +import UIKit + +var str = "Hello, playground" diff --git a/Listenable Example.playground/contents.xcplayground b/Listenable Example.playground/contents.xcplayground new file mode 100644 index 0000000..5da2641 --- /dev/null +++ b/Listenable Example.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Listenable.xcworkspace/contents.xcworkspacedata b/Listenable.xcworkspace/contents.xcworkspacedata index 2dcd7b0..1913568 100644 --- a/Listenable.xcworkspace/contents.xcworkspacedata +++ b/Listenable.xcworkspace/contents.xcworkspacedata @@ -2,7 +2,7 @@ + location = "group:Listenable Example.playground"> diff --git a/scripts/push.sh b/scripts/push.sh deleted file mode 100644 index d68fc3d..0000000 --- a/scripts/push.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -pod trunk push From 9fc1e21419a45dcbfc39fe3db36687e918aa7514 Mon Sep 17 00:00:00 2001 From: Merrick Sapsford Date: Thu, 27 Jul 2017 11:57:27 +0100 Subject: [PATCH 5/8] Update example playground --- Listenable Example.playground/Contents.swift | 50 +++++++++++++++++-- .../contents.xcplayground | 2 +- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/Listenable Example.playground/Contents.swift b/Listenable Example.playground/Contents.swift index c9a6742..b379db8 100644 --- a/Listenable Example.playground/Contents.swift +++ b/Listenable Example.playground/Contents.swift @@ -1,5 +1,49 @@ -//: Playground - noun: a place where people can play - import UIKit +import XCPlayground +import Listenable + +/*: + # Listenable + **A Swift object that provides an observable platform for multiple listeners.** + + This playground shows some of the useful observable behaviour that **Listenable** can be used for. + + ### Basics + + Create an object that you want to make observable, and make it inherit from Listenable, parameterized with the protocol that observers must conform to. + */ +protocol ObjectObservable { + + func doStuff() +} + +class Object: Listenable { + +} +/*: + With an instance of your observable object, you can then attach listeners that will receive updates when prompted. + */ +class Listener: ObjectObservable { + + func doStuff() { + print("Update Received") + } +} + +let observableObject = Object() +let listener = Listener() + +observableObject.add(listener: listener) + +/*: + Then you can simply prompt the listeners with updates whenever you require from your observable object. + */ -var str = "Hello, playground" +extension Object { + + func action() { + updateListeners { (listener, index) in + listener.doStuff() + } + } +} diff --git a/Listenable Example.playground/contents.xcplayground b/Listenable Example.playground/contents.xcplayground index 5da2641..3596865 100644 --- a/Listenable Example.playground/contents.xcplayground +++ b/Listenable Example.playground/contents.xcplayground @@ -1,4 +1,4 @@ - + \ No newline at end of file From 03a718a79f3082498323ac08a010f02392de5f98 Mon Sep 17 00:00:00 2001 From: Merrick Sapsford Date: Thu, 27 Jul 2017 14:16:25 +0100 Subject: [PATCH 6/8] Update example playground --- Listenable Example.playground/Contents.swift | 12 ++++++++++-- Listenable Example.playground/contents.xcplayground | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Listenable Example.playground/Contents.swift b/Listenable Example.playground/Contents.swift index b379db8..c505c27 100644 --- a/Listenable Example.playground/Contents.swift +++ b/Listenable Example.playground/Contents.swift @@ -34,11 +34,9 @@ let observableObject = Object() let listener = Listener() observableObject.add(listener: listener) - /*: Then you can simply prompt the listeners with updates whenever you require from your observable object. */ - extension Object { func action() { @@ -47,3 +45,13 @@ extension Object { } } } +/*: + ### Prioritisation and other niceties + + **Listenable** provides the ability to register listeners with varying priorities. This allows certain listeners to recieve updates before others depending on their priority. + */ +let highPriorityListener = Listener() +observableObject.add(listener: highPriorityListener, priority: .high) +/*: + `highPriorityListener` will receive any updates before `listener` as the default priority is `.low`. Custom priorities can also be set by using the `.custom(value: Int)` value. + */ diff --git a/Listenable Example.playground/contents.xcplayground b/Listenable Example.playground/contents.xcplayground index 3596865..89da2d4 100644 --- a/Listenable Example.playground/contents.xcplayground +++ b/Listenable Example.playground/contents.xcplayground @@ -1,4 +1,4 @@ - + \ No newline at end of file From 43f8896504c3254a37ab6e44b500bc411781c492 Mon Sep 17 00:00:00 2001 From: Merrick Sapsford Date: Thu, 27 Jul 2017 14:21:44 +0100 Subject: [PATCH 7/8] Update version number --- Listenable.podspec | 2 +- README.md | 5 +++++ Sources/Listenable/Info.plist | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Listenable.podspec b/Listenable.podspec index 4efac21..bfc9358 100644 --- a/Listenable.podspec +++ b/Listenable.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.platform = :ios, "9.0" s.requires_arc = true - s.version = "1.0.0" + s.version = "2.0.0.beta.1" s.summary = "Observable pattern in Swift made easy" s.description = <<-DESC Swift object that provides an observable platform for multiple listeners. diff --git a/README.md b/README.md index bbac8cf..cf60858 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ Swift object that provides an observable platform for multiple listeners. +## Requirements +- iOS 9.0+ +- Xcode 8.x+ +- Swift 3 + ## Installation Listenable is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: ```ruby diff --git a/Sources/Listenable/Info.plist b/Sources/Listenable/Info.plist index 20b05ec..107eb1c 100644 --- a/Sources/Listenable/Info.plist +++ b/Sources/Listenable/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0.0 + 2.0.0.beta.1 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass From 6bcea6b7b47b7301c65357955481b9066b20912b Mon Sep 17 00:00:00 2001 From: Merrick Sapsford Date: Tue, 12 Sep 2017 21:51:14 +0100 Subject: [PATCH 8/8] Update version number --- Listenable.podspec | 2 +- Sources/Listenable/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Listenable.podspec b/Listenable.podspec index bfc9358..c10158b 100644 --- a/Listenable.podspec +++ b/Listenable.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.platform = :ios, "9.0" s.requires_arc = true - s.version = "2.0.0.beta.1" + s.version = "2.0.0" s.summary = "Observable pattern in Swift made easy" s.description = <<-DESC Swift object that provides an observable platform for multiple listeners. diff --git a/Sources/Listenable/Info.plist b/Sources/Listenable/Info.plist index 107eb1c..d87c8b3 100644 --- a/Sources/Listenable/Info.plist +++ b/Sources/Listenable/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.0.beta.1 + 2.0.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass