Skip to content

Commit 14b6158

Browse files
author
Unknown
committed
migrate to swift 5, increase deployment target to 11.0
1 parent 561a2f1 commit 14b6158

File tree

6 files changed

+62
-55
lines changed

6 files changed

+62
-55
lines changed

Example/Example.xcodeproj/project.pbxproj

+5-2
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@
306306
developmentRegion = English;
307307
hasScannedForEncodings = 0;
308308
knownRegions = (
309+
English,
309310
en,
310311
Base,
311312
);
@@ -426,11 +427,12 @@
426427
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
427428
GCC_WARN_UNUSED_FUNCTION = YES;
428429
GCC_WARN_UNUSED_VARIABLE = YES;
429-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
430+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
430431
MTL_ENABLE_DEBUG_INFO = YES;
431432
ONLY_ACTIVE_ARCH = YES;
432433
SDKROOT = iphoneos;
433434
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
435+
SWIFT_VERSION = 5.0;
434436
};
435437
name = Debug;
436438
};
@@ -471,10 +473,11 @@
471473
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
472474
GCC_WARN_UNUSED_FUNCTION = YES;
473475
GCC_WARN_UNUSED_VARIABLE = YES;
474-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
476+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
475477
MTL_ENABLE_DEBUG_INFO = NO;
476478
SDKROOT = iphoneos;
477479
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
480+
SWIFT_VERSION = 5.0;
478481
VALIDATE_PRODUCT = YES;
479482
};
480483
name = Release;

Example/Example/AppDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
77

88
var window: UIWindow?
99

10-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
10+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1111
let appearance = UINavigationBar.appearance()
1212
appearance.titleTextAttributes = [
1313
.font: UIFont(name: "TrendSansOne", size: 20)!,

Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json

+24-19
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,52 @@
22
"images" : [
33
{
44
"idiom" : "iphone",
5-
"size" : "20x20",
6-
"scale" : "2x"
5+
"scale" : "2x",
6+
"size" : "20x20"
77
},
88
{
99
"idiom" : "iphone",
10-
"size" : "20x20",
11-
"scale" : "3x"
10+
"scale" : "3x",
11+
"size" : "20x20"
1212
},
1313
{
1414
"idiom" : "iphone",
15-
"size" : "29x29",
16-
"scale" : "2x"
15+
"scale" : "2x",
16+
"size" : "29x29"
1717
},
1818
{
1919
"idiom" : "iphone",
20-
"size" : "29x29",
21-
"scale" : "3x"
20+
"scale" : "3x",
21+
"size" : "29x29"
2222
},
2323
{
2424
"idiom" : "iphone",
25-
"size" : "40x40",
26-
"scale" : "2x"
25+
"scale" : "2x",
26+
"size" : "40x40"
2727
},
2828
{
2929
"idiom" : "iphone",
30-
"size" : "40x40",
31-
"scale" : "3x"
30+
"scale" : "3x",
31+
"size" : "40x40"
3232
},
3333
{
3434
"idiom" : "iphone",
35-
"size" : "60x60",
36-
"scale" : "2x"
35+
"scale" : "2x",
36+
"size" : "60x60"
3737
},
3838
{
3939
"idiom" : "iphone",
40-
"size" : "60x60",
41-
"scale" : "3x"
40+
"scale" : "3x",
41+
"size" : "60x60"
42+
},
43+
{
44+
"idiom" : "ios-marketing",
45+
"scale" : "1x",
46+
"size" : "1024x1024"
4247
}
4348
],
4449
"info" : {
45-
"version" : 1,
46-
"author" : "xcode"
50+
"author" : "xcode",
51+
"version" : 1
4752
}
48-
}
53+
}

Persei.xcodeproj/project.pbxproj

+16-7
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,22 @@
156156
attributes = {
157157
LastSwiftMigration = 0710;
158158
LastSwiftUpdateCheck = 0710;
159-
LastUpgradeCheck = 0910;
159+
LastUpgradeCheck = 1140;
160160
ORGANIZATIONNAME = Yalantis;
161161
TargetAttributes = {
162162
ADE973F91A78F7AA0040B7C1 = {
163163
CreatedOnToolsVersion = 6.1.1;
164-
LastSwiftMigration = 0910;
164+
LastSwiftMigration = 1140;
165165
};
166166
};
167167
};
168168
buildConfigurationList = ADE973F41A78F7AA0040B7C1 /* Build configuration list for PBXProject "Persei" */;
169169
compatibilityVersion = "Xcode 3.2";
170-
developmentRegion = English;
170+
developmentRegion = en;
171171
hasScannedForEncodings = 0;
172172
knownRegions = (
173173
en,
174+
Base,
174175
);
175176
mainGroup = ADE973F01A78F7AA0040B7C1;
176177
productRefGroup = ADE973FB1A78F7AA0040B7C1 /* Products */;
@@ -215,6 +216,7 @@
215216
isa = XCBuildConfiguration;
216217
buildSettings = {
217218
ALWAYS_SEARCH_USER_PATHS = NO;
219+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
218220
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
219221
CLANG_CXX_LIBRARY = "libc++";
220222
CLANG_ENABLE_MODULES = YES;
@@ -223,12 +225,14 @@
223225
CLANG_WARN_BOOL_CONVERSION = YES;
224226
CLANG_WARN_COMMA = YES;
225227
CLANG_WARN_CONSTANT_CONVERSION = YES;
228+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
226229
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
227230
CLANG_WARN_EMPTY_BODY = YES;
228231
CLANG_WARN_ENUM_CONVERSION = YES;
229232
CLANG_WARN_INFINITE_RECURSION = YES;
230233
CLANG_WARN_INT_CONVERSION = YES;
231234
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
235+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
232236
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
233237
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
234238
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -256,11 +260,12 @@
256260
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
257261
GCC_WARN_UNUSED_FUNCTION = YES;
258262
GCC_WARN_UNUSED_VARIABLE = YES;
259-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
263+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
260264
MTL_ENABLE_DEBUG_INFO = YES;
261265
ONLY_ACTIVE_ARCH = YES;
262266
SDKROOT = iphoneos;
263267
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
268+
SWIFT_VERSION = 5.0;
264269
TARGETED_DEVICE_FAMILY = "1,2";
265270
VERSIONING_SYSTEM = "apple-generic";
266271
VERSION_INFO_PREFIX = "";
@@ -271,6 +276,7 @@
271276
isa = XCBuildConfiguration;
272277
buildSettings = {
273278
ALWAYS_SEARCH_USER_PATHS = NO;
279+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
274280
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
275281
CLANG_CXX_LIBRARY = "libc++";
276282
CLANG_ENABLE_MODULES = YES;
@@ -279,12 +285,14 @@
279285
CLANG_WARN_BOOL_CONVERSION = YES;
280286
CLANG_WARN_COMMA = YES;
281287
CLANG_WARN_CONSTANT_CONVERSION = YES;
288+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
282289
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
283290
CLANG_WARN_EMPTY_BODY = YES;
284291
CLANG_WARN_ENUM_CONVERSION = YES;
285292
CLANG_WARN_INFINITE_RECURSION = YES;
286293
CLANG_WARN_INT_CONVERSION = YES;
287294
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
295+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
288296
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
289297
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
290298
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -305,10 +313,11 @@
305313
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
306314
GCC_WARN_UNUSED_FUNCTION = YES;
307315
GCC_WARN_UNUSED_VARIABLE = YES;
308-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
316+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
309317
MTL_ENABLE_DEBUG_INFO = NO;
310318
SDKROOT = iphoneos;
311319
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
320+
SWIFT_VERSION = 5.0;
312321
TARGETED_DEVICE_FAMILY = "1,2";
313322
VALIDATE_PRODUCT = YES;
314323
VERSIONING_SYSTEM = "apple-generic";
@@ -333,7 +342,7 @@
333342
SKIP_INSTALL = YES;
334343
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
335344
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
336-
SWIFT_VERSION = 4.0;
345+
SWIFT_VERSION = 5.0;
337346
};
338347
name = Debug;
339348
};
@@ -353,7 +362,7 @@
353362
PRODUCT_NAME = "$(TARGET_NAME)";
354363
SKIP_INSTALL = YES;
355364
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
356-
SWIFT_VERSION = 4.0;
365+
SWIFT_VERSION = 5.0;
357366
};
358367
name = Release;
359368
};

Persei.xcodeproj/xcshareddata/xcschemes/Persei.xcscheme

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0910"
3+
LastUpgradeVersion = "1140"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -40,8 +40,16 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43-
language = ""
4443
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<MacroExpansion>
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "ADE973F91A78F7AA0040B7C1"
48+
BuildableName = "Persei.framework"
49+
BlueprintName = "Persei"
50+
ReferencedContainer = "container:Persei.xcodeproj">
51+
</BuildableReference>
52+
</MacroExpansion>
4553
<Testables>
4654
<TestableReference
4755
skipped = "NO">
@@ -54,23 +62,11 @@
5462
</BuildableReference>
5563
</TestableReference>
5664
</Testables>
57-
<MacroExpansion>
58-
<BuildableReference
59-
BuildableIdentifier = "primary"
60-
BlueprintIdentifier = "ADE973F91A78F7AA0040B7C1"
61-
BuildableName = "Persei.framework"
62-
BlueprintName = "Persei"
63-
ReferencedContainer = "container:Persei.xcodeproj">
64-
</BuildableReference>
65-
</MacroExpansion>
66-
<AdditionalOptions>
67-
</AdditionalOptions>
6865
</TestAction>
6966
<LaunchAction
7067
buildConfiguration = "Debug"
7168
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7269
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
73-
language = ""
7470
launchStyle = "0"
7571
useCustomWorkingDirectory = "NO"
7672
ignoresPersistentStateOnLaunch = "NO"
@@ -86,8 +82,6 @@
8682
ReferencedContainer = "container:Persei.xcodeproj">
8783
</BuildableReference>
8884
</MacroExpansion>
89-
<AdditionalOptions>
90-
</AdditionalOptions>
9185
</LaunchAction>
9286
<ProfileAction
9387
buildConfiguration = "Release"

Persei/Source/Core/StickyHeaderView.swift

+6-10
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ open class StickyHeaderView: UIView {
5151
if let view = superview as? UIScrollView {
5252
view.addObserver(self, forKeyPath: #keyPath(UIScrollView.contentOffset), options: [.initial, .new], context: &ContentOffsetContext)
5353
view.panGestureRecognizer.addTarget(self, action: #selector(StickyHeaderView.handlePan))
54-
view.sendSubview(toBack: self)
54+
view.sendSubviewToBack(self)
5555
}
5656
}
5757

@@ -72,7 +72,7 @@ open class StickyHeaderView: UIView {
7272
view.frame = contentContainer.bounds
7373
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
7474
contentContainer.addSubview(view)
75-
contentContainer.sendSubview(toBack: view)
75+
contentContainer.sendSubviewToBack(view)
7676
}
7777
}
7878
}
@@ -104,7 +104,7 @@ open class StickyHeaderView: UIView {
104104
}
105105

106106
// MARK: - ScrollView
107-
private var scrollView: UIScrollView! { return superview as! UIScrollView }
107+
private var scrollView: UIScrollView! { return (superview as! UIScrollView) }
108108

109109
// MARK: - KVO
110110
open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
@@ -261,13 +261,9 @@ open class StickyHeaderView: UIView {
261261
}
262262

263263
open override func sizeThatFits(_: CGSize) -> CGSize {
264-
var height: CGFloat = 0
265-
if revealed {
266-
height = appliedInsets.top - scrollView.normalizedContentOffset.y
267-
} else {
268-
height = scrollView.normalizedContentOffset.y * -1
269-
}
270-
264+
let revealedHeight: CGFloat = appliedInsets.top - scrollView.normalizedContentOffset.y
265+
let collapsedHeight: CGFloat = scrollView.normalizedContentOffset.y * -1
266+
let height: CGFloat = revealed ? revealedHeight : collapsedHeight
271267
let output = CGSize(width: scrollView.bounds.width, height: max(height, 0))
272268

273269
return output

0 commit comments

Comments
 (0)