Skip to content

Commit

Permalink
Merge pull request #30 from prolificinteractive/swift-4.2
Browse files Browse the repository at this point in the history
Updated codebase to Swift 4.2
  • Loading branch information
ThibaultKlein authored Sep 19, 2018
2 parents 870b88f + 1c04830 commit 884e9c2
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.2
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# # * https://github.com/supermarin/xcpretty#usage
#
language: objective-c
osx_image: xcode9
osx_image: xcode10
cache: cocoapods
podfile: Example/Podfile
before_install:
#- gem install cocoapods # Since Travis is not always on latest version
- gem install cocoapods # Since Travis is not always on latest version
#- pod repo update
#- pod install --project-directory=Example
- gem install bundler
Expand Down
26 changes: 23 additions & 3 deletions Bellerophon/Bellerophon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,18 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Prolific Interactive";
TargetAttributes = {
8EED59C71C40194500CB3223 = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = 5ZZ7W4SB26;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
ABADBB921CCA92580057F491 = {
CreatedOnToolsVersion = 7.3;
DevelopmentTeam = 5ZZ7W4SB26;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -264,14 +264,22 @@
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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = 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;
Expand Down Expand Up @@ -315,14 +323,22 @@
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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = 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;
Expand Down Expand Up @@ -368,6 +384,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.Bellerophon;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -388,6 +405,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -401,6 +419,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.BellerophonTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -415,6 +434,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.BellerophonTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Bellerophon/Bellerophon/Sources/BPConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public struct BellerophonConfig {
///
/// - Returns: List of UIViews that exist within config
internal func allViews() -> [UIView] {
return [killSwitchView, forceUpdateView].flatMap ({ $0 })
return [killSwitchView, forceUpdateView].compactMap ({ $0 })
}

}
6 changes: 3 additions & 3 deletions Bellerophon/Bellerophon/Sources/BPManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class BellerophonManager: NSObject {

NotificationCenter.default.addObserver(self,
selector: #selector(stopTimer),
name: NSNotification.Name.UIApplicationDidEnterBackground,
name: UIApplication.didEnterBackgroundNotification,
object: nil)
}

Expand All @@ -40,10 +40,10 @@ public class BellerophonManager: NSObject {
/// The kill switch window.
internal lazy var bellerophonWindow: UIWindow = {
let window = UIWindow(frame: UIScreen.main.bounds)
window.windowLevel = UIWindowLevelAlert
window.windowLevel = UIWindow.Level.alert
let rootViewController = UIViewController()
let viewList = [self.config.killSwitchView, self.config.forceUpdateView]
viewList.flatMap ({ $0 }).forEach {
viewList.compactMap ({ $0 }).forEach {
$0.isHidden = true
rootViewController.view.addSubview($0)
}
Expand Down
52 changes: 29 additions & 23 deletions Example/Bellerophon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
8EF3B9B11B88DA1B007A4E5D /* Frameworks */,
8EF3B9B21B88DA1B007A4E5D /* Resources */,
9B09ADBD7EAFD1BE147415D3 /* [CP] Embed Pods Frameworks */,
B7D993AAEAC5CAB521D665C9 /* [CP] Copy Pods Resources */,
ECA4273D3E60FBF1E95CE374 /* Embed Pods Frameworks */,
);
buildRules = (
Expand All @@ -137,13 +136,13 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Prolific Interactive";
TargetAttributes = {
8EF3B9B31B88DA1B007A4E5D = {
CreatedOnToolsVersion = 6.4;
DevelopmentTeam = 5ZZ7W4SB26;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
Expand Down Expand Up @@ -190,13 +189,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Bellerophon-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9B09ADBD7EAFD1BE147415D3 /* [CP] Embed Pods Frameworks */ = {
Expand All @@ -205,30 +207,20 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Bellerophon/Pods-Bellerophon-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/Bellerophon/Bellerophon.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Bellerophon.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Bellerophon/Pods-Bellerophon-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
B7D993AAEAC5CAB521D665C9 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Bellerophon/Pods-Bellerophon-resources.sh\"\n";
showEnvVarsInLog = 0;
};
ECA4273D3E60FBF1E95CE374 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -287,14 +279,22 @@
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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = 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;
Expand Down Expand Up @@ -334,14 +334,22 @@
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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = 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;
Expand Down Expand Up @@ -369,7 +377,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = D7DD618AED2C3A37CD2A4A11 /* Pods-Bellerophon.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 5ZZ7W4SB26;
Expand All @@ -378,15 +385,14 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.prolificinteractive.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_MODULE_NAME = BellerophonExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
8EF3B9D51B88DA1B007A4E5D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 996864517C990A000065B674 /* Pods-Bellerophon.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 5ZZ7W4SB26;
Expand All @@ -396,7 +402,7 @@
PRODUCT_MODULE_NAME = BellerophonExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
7 changes: 5 additions & 2 deletions Example/Bellerophon/BellerophonModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ typealias JSON = [String: Any]
// "userMessage": null
//}
class BellerophonModel: BellerophonObservable {

let isAPIInactive: Bool
let shouldForceUpdate: Bool
let interval: TimeInterval
let userMessageStr: String
var userMessageStr: String

required init?(json: JSON) {
isAPIInactive = json["apiInactive"] as? Bool ?? false
Expand Down Expand Up @@ -56,4 +55,8 @@ class BellerophonModel: BellerophonObservable {
return self.userMessageStr
}

func setUserMessage(_ message: String) {
userMessageStr = message
}

}
2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target 'Bellerophon' do
pod 'Alamofire', '4.4.0'
pod 'Alamofire'
pod 'Bellerophon', :path => "../"
end

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org'

gem 'cocoapods', '1.1.1'
gem 'cocoapods', '1.5.0'
Loading

0 comments on commit 884e9c2

Please sign in to comment.