From e6bdba0504e7cad51d4d16082b808075787d204f Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Fri, 30 Mar 2018 12:19:27 +0300 Subject: [PATCH] Xcode 9.3 migration --- CHANGELOG.md | 2 ++ LeadKit.xcodeproj/project.pbxproj | 6 +++++- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Sources/Classes/DataLoading/Cursors/MapCursor.swift | 2 +- ...gurableNetworkService+DefaultImplementation.swift | 9 --------- .../TimeInterval/TimeInterval+DateComponents.swift | 12 ++++++------ Sources/Extensions/UIView/UIView+Layout.swift | 4 ++-- 7 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 LeadKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ff47f5..785d94ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ### 0.7.2 +- **Update**: Xcode 9.3 migration. +- **Remove**: Default initializer for Network service that conforms to `ConfigurableNetworkService` protocol. - **[Breaking Change]**: `DateFormattingService` class replaced with protocol. - **Add**: `SwiftDate` dependency for `DateFormattingService`. - **Add**: `ViewBackground` enum that describes possible view backgrounds. diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index ec752313..f40506fc 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -1930,7 +1930,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Touch Instinct"; TargetAttributes = { 67186B271EB248F100CFAFFB = { @@ -3426,12 +3426,14 @@ 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; @@ -3482,12 +3484,14 @@ 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; diff --git a/LeadKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LeadKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/LeadKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Sources/Classes/DataLoading/Cursors/MapCursor.swift b/Sources/Classes/DataLoading/Cursors/MapCursor.swift index af29dff3..50cd45e6 100644 --- a/Sources/Classes/DataLoading/Cursors/MapCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/MapCursor.swift @@ -81,7 +81,7 @@ public class MapCursor: CursorType, RxDataSource { public func loadNextBatch() -> Single<[T]> { return cursor.loadNextBatch().map { newItems in - let transformedNewItems = newItems.flatMap(self.transform) + let transformedNewItems = newItems.compactMap(self.transform) self.elements += transformedNewItems return transformedNewItems diff --git a/Sources/Extensions/NetworkService/ConfigurableNetworkService+DefaultImplementation.swift b/Sources/Extensions/NetworkService/ConfigurableNetworkService+DefaultImplementation.swift index 5281bd61..b03fe381 100644 --- a/Sources/Extensions/NetworkService/ConfigurableNetworkService+DefaultImplementation.swift +++ b/Sources/Extensions/NetworkService/ConfigurableNetworkService+DefaultImplementation.swift @@ -52,12 +52,3 @@ public extension ConfigurableNetworkService { } } - -public extension ConfigurableNetworkService where Self: NetworkService { - - /// Convenience initializer with default session manager. - init() { - self.init(sessionManager: Self.sessionManager) - } - -} diff --git a/Sources/Extensions/TimeInterval/TimeInterval+DateComponents.swift b/Sources/Extensions/TimeInterval/TimeInterval+DateComponents.swift index 19049873..5b260f5d 100644 --- a/Sources/Extensions/TimeInterval/TimeInterval+DateComponents.swift +++ b/Sources/Extensions/TimeInterval/TimeInterval+DateComponents.swift @@ -67,14 +67,14 @@ extension TimeInterval { Supported components: days, hours, minutes, seconds */ public var timeComponents: TimeComponents { - var ti = Int(self) - let days = (ti / TimeInterval.secondsInDay) % TimeInterval.secondsInDay - ti -= days * TimeInterval.secondsInDay + var timeInterval = Int(self) + let days = (timeInterval / TimeInterval.secondsInDay) % TimeInterval.secondsInDay + timeInterval -= days * TimeInterval.secondsInDay return ( days, - (ti / TimeInterval.secondsInHour) % TimeInterval.secondsInHour, - (ti / TimeInterval.secondsInMinute) % TimeInterval.secondsInMinute, - ti % TimeInterval.secondsInMinute + (timeInterval / TimeInterval.secondsInHour) % TimeInterval.secondsInHour, + (timeInterval / TimeInterval.secondsInMinute) % TimeInterval.secondsInMinute, + timeInterval % TimeInterval.secondsInMinute ) } diff --git a/Sources/Extensions/UIView/UIView+Layout.swift b/Sources/Extensions/UIView/UIView+Layout.swift index 7a75bc2c..359487e8 100644 --- a/Sources/Extensions/UIView/UIView+Layout.swift +++ b/Sources/Extensions/UIView/UIView+Layout.swift @@ -64,7 +64,7 @@ public extension UIView { translatesAutoresizingMaskIntoConstraints = false let constraints: [NSLayoutConstraint] - if #available(iOS 11, *) { + if #available(iOS 11, tvOS 11, *) { constraints = [ topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor, constant: insets.top), leadingAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.leadingAnchor, constant: insets.left), @@ -89,7 +89,7 @@ public extension UIView { } let constraints: [NSLayoutConstraint] - if #available(iOS 11, *) { + if #available(iOS 11, tvOS 11, *) { constraints = [ topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor), bottomAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.bottomAnchor),