From 5849b3c73d49e1271ad915dab34dcce58ead28be Mon Sep 17 00:00:00 2001 From: ApolloZhu Date: Thu, 18 Oct 2018 21:30:21 -0400 Subject: [PATCH] Update to Swift 4.2 And Alamofire to 4.7.3 --- EmbeddedSocialClient.podspec | 2 +- .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../Classes/Swaggers/APIs.swift | 8 +-- .../Swaggers/AlamofireImplementations.swift | 2 +- .../Classes/Swaggers/Configuration.swift | 4 +- .../Classes/Swaggers/Extensions.swift | 4 +- .../Classes/Swaggers/Models.swift | 14 ++--- .../project.pbxproj | 57 +++++++------------ Podfile | 2 +- Podfile.lock | 18 +++--- 10 files changed, 51 insertions(+), 68 deletions(-) create mode 100644 EmbeddedSocialClient.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/EmbeddedSocialClient.podspec b/EmbeddedSocialClient.podspec index 1ed12c3..cbc0dd5 100644 --- a/EmbeddedSocialClient.podspec +++ b/EmbeddedSocialClient.podspec @@ -9,5 +9,5 @@ Pod::Spec.new do |s| s.authors = 'Microsoft Embedded Social' s.license = 'MIT' s.source_files = 'EmbeddedSocialClient/Classes/Swaggers/**/*.swift' - s.dependency 'Alamofire', '~> 4.0' + s.dependency 'Alamofire', '~> 4.7.3' end diff --git a/EmbeddedSocialClient.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/EmbeddedSocialClient.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/EmbeddedSocialClient.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/EmbeddedSocialClient/Classes/Swaggers/APIs.swift b/EmbeddedSocialClient/Classes/Swaggers/APIs.swift index 8f40dee..0a71096 100644 --- a/EmbeddedSocialClient/Classes/Swaggers/APIs.swift +++ b/EmbeddedSocialClient/Classes/Swaggers/APIs.swift @@ -7,10 +7,10 @@ import Foundation open class EmbeddedSocialClientAPI { - open static var basePath = "https://api.embeddedsocial.microsoft.com" - open static var credential: URLCredential? - open static var customHeaders: [String:String] = [:] - open static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() + public static var basePath = "https://api.embeddedsocial.microsoft.com" + public static var credential: URLCredential? + public static var customHeaders: [String:String] = [:] + public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() } open class APIBase { diff --git a/EmbeddedSocialClient/Classes/Swaggers/AlamofireImplementations.swift b/EmbeddedSocialClient/Classes/Swaggers/AlamofireImplementations.swift index fd981a0..07b0332 100644 --- a/EmbeddedSocialClient/Classes/Swaggers/AlamofireImplementations.swift +++ b/EmbeddedSocialClient/Classes/Swaggers/AlamofireImplementations.swift @@ -155,7 +155,7 @@ open class AlamofireRequestBuilder: RequestBuilder { if stringResponse.result.isFailure { completion( nil, - ErrorResponse.HttpError(statusCode: stringResponse.response?.statusCode ?? 500, data: stringResponse.data, error: stringResponse.result.error as Error!) + ErrorResponse.HttpError(statusCode: stringResponse.response?.statusCode ?? 500, data: stringResponse.data, error: stringResponse.result.error!) ) return } diff --git a/EmbeddedSocialClient/Classes/Swaggers/Configuration.swift b/EmbeddedSocialClient/Classes/Swaggers/Configuration.swift index c03a10b..c7795c3 100644 --- a/EmbeddedSocialClient/Classes/Swaggers/Configuration.swift +++ b/EmbeddedSocialClient/Classes/Swaggers/Configuration.swift @@ -10,6 +10,6 @@ open class Configuration { // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. - open static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" -} \ No newline at end of file +} diff --git a/EmbeddedSocialClient/Classes/Swaggers/Extensions.swift b/EmbeddedSocialClient/Classes/Swaggers/Extensions.swift index d310882..3bd1b51 100644 --- a/EmbeddedSocialClient/Classes/Swaggers/Extensions.swift +++ b/EmbeddedSocialClient/Classes/Swaggers/Extensions.swift @@ -142,10 +142,8 @@ public final class ISOFullDate: CustomStringConvertible { */ public static func from(string: String) -> ISOFullDate? { let components = string - .characters .split(separator: "-") - .map(String.init) - .flatMap { Int($0) } + .compactMap { Int($0) } guard components.count == 3 else { return nil } return ISOFullDate( diff --git a/EmbeddedSocialClient/Classes/Swaggers/Models.swift b/EmbeddedSocialClient/Classes/Swaggers/Models.swift index ef41aa6..f088348 100644 --- a/EmbeddedSocialClient/Classes/Swaggers/Models.swift +++ b/EmbeddedSocialClient/Classes/Swaggers/Models.swift @@ -16,9 +16,9 @@ public enum ErrorResponse : Error { } open class Response { - open let statusCode: Int - open let header: [String: String] - open let body: T? + public let statusCode: Int + public let header: [String: String] + public let body: T? public init(statusCode: Int, header: [String: String], body: T?) { self.statusCode = statusCode @@ -195,7 +195,7 @@ class Decoders { } } - static func decodeOptional(clazz: T, source: AnyObject) -> Decoded { + static func decodeOptional(clazz: T, source: AnyObject) -> Decoded where T.RawValue == U { if let value = source as? U { if let enumValue = T.init(rawValue: value) { return .success(enumValue) @@ -758,11 +758,7 @@ class Decoders { } // Decoder for Object Decoders.addDecoder(clazz: Object.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in - if let source = source as? Any { - return .success(source) - } else { - return .failure(.typeMismatch(expected: "Typealias Object", actual: "\(source)")) - } + return .success(source) } // Decoder for PostBlobResponse Decoders.addDecoder(clazz: PostBlobResponse.self) { (source: AnyObject, instance: AnyObject?) -> Decoded in diff --git a/EmbeddedSocialClient/EmbeddedSocialClient.xcodeproj/project.pbxproj b/EmbeddedSocialClient/EmbeddedSocialClient.xcodeproj/project.pbxproj index 40b8690..478c1c8 100644 --- a/EmbeddedSocialClient/EmbeddedSocialClient.xcodeproj/project.pbxproj +++ b/EmbeddedSocialClient/EmbeddedSocialClient.xcodeproj/project.pbxproj @@ -379,7 +379,6 @@ 6F5B443A1F21511200FE6092 /* Frameworks */, 6F5B443B1F21511200FE6092 /* Headers */, 6F5B443C1F21511200FE6092 /* Resources */, - D9FD94556B3F579E55A0C1F4 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -399,7 +398,6 @@ 6F5B44441F21511200FE6092 /* Frameworks */, 6F5B44451F21511200FE6092 /* Resources */, 9E9BEEF1CDE103FC88A48639 /* [CP] Embed Pods Frameworks */, - BF17BD322AAA6A290F230F22 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -424,11 +422,13 @@ 6F5B443D1F21511200FE6092 = { CreatedOnToolsVersion = 8.3.3; DevelopmentTeam = UBF8T346G9; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; 6F5B44461F21511200FE6092 = { CreatedOnToolsVersion = 8.3.3; DevelopmentTeam = UBF8T346G9; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; }; @@ -475,13 +475,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-EmbeddedSocialClientTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - 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"; + 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; }; 9E9BEEF1CDE103FC88A48639 /* [CP] Embed Pods Frameworks */ = { @@ -490,58 +493,36 @@ files = ( ); inputPaths = ( + "${SRCROOT}/../Pods/Target Support Files/Pods-EmbeddedSocialClientTests/Pods-EmbeddedSocialClientTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", + "${BUILT_PRODUCTS_DIR}/EmbeddedSocialClient/EmbeddedSocialClient.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/EmbeddedSocialClient.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-EmbeddedSocialClientTests/Pods-EmbeddedSocialClientTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - BF17BD322AAA6A290F230F22 /* [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-EmbeddedSocialClientTests/Pods-EmbeddedSocialClientTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - D9FD94556B3F579E55A0C1F4 /* [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-EmbeddedSocialClient/Pods-EmbeddedSocialClient-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; DDEB0F64DBCCBF408C0E7543 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-EmbeddedSocialClient-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - 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"; + 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; }; /* End PBXShellScriptBuildPhase section */ @@ -760,7 +741,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.embeddedsocial.EmbeddedSocialClient; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -780,7 +761,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.embeddedsocial.EmbeddedSocialClient; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -794,7 +775,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.embeddedsocial.EmbeddedSocialClientTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -808,7 +789,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.embeddedsocial.EmbeddedSocialClientTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/Podfile b/Podfile index 50be5e3..e0bc13a 100644 --- a/Podfile +++ b/Podfile @@ -4,7 +4,7 @@ project 'EmbeddedSocialClient/EmbeddedSocialClient.xcodeproj' target 'EmbeddedSocialClient' do use_frameworks! - pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '4.0.0' + pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '4.7.3' pod 'EmbeddedSocialClient', :path => 'EmbeddedSocialClient.podspec' end diff --git a/Podfile.lock b/Podfile.lock index fdf8fcc..0cb0cb9 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,28 +1,28 @@ PODS: - - Alamofire (4.0.0) + - Alamofire (4.7.3) - EmbeddedSocialClient (0.7.0): - - Alamofire (~> 4.0) + - Alamofire (~> 4.7.3) DEPENDENCIES: - - Alamofire (from `https://github.com/Alamofire/Alamofire.git`, tag `4.0.0`) + - Alamofire (from `https://github.com/Alamofire/Alamofire.git`, tag `4.7.3`) - EmbeddedSocialClient (from `EmbeddedSocialClient.podspec`) EXTERNAL SOURCES: Alamofire: :git: https://github.com/Alamofire/Alamofire.git - :tag: 4.0.0 + :tag: 4.7.3 EmbeddedSocialClient: :path: EmbeddedSocialClient.podspec CHECKOUT OPTIONS: Alamofire: :git: https://github.com/Alamofire/Alamofire.git - :tag: 4.0.0 + :tag: 4.7.3 SPEC CHECKSUMS: - Alamofire: fef59f00388f267e52d9b432aa5d93dc97190f14 - EmbeddedSocialClient: 48697371a875a7fd45a4d4e01a753d283b07588a + Alamofire: c7287b6e5d7da964a70935e5db17046b7fde6568 + EmbeddedSocialClient: 249e338f7d523103317085f23698b94eb2ac1315 -PODFILE CHECKSUM: 90f5db337b70ae434928649291325c32b12c72b8 +PODFILE CHECKSUM: 41a2c097556a0adc771e42432ecbbcea8ef81a8e -COCOAPODS: 1.2.1 +COCOAPODS: 1.5.3