Skip to content

Commit 1adc246

Browse files
committed
chapter 4 examples
1 parent 35751c7 commit 1adc246

File tree

111 files changed

+3822
-357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3822
-357
lines changed

bk2ch04p124presentationLayerAcquisition/PresentationLayerTest.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
278278
DEVELOPMENT_TEAM = W3LHX5RGV2;
279279
INFOPLIST_FILE = PresentationLayerTest/Info.plist;
280-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
280+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
281281
LD_RUNPATH_SEARCH_PATHS = (
282282
"$(inherited)",
283283
"@executable_path/Frameworks",
@@ -295,7 +295,7 @@
295295
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
296296
DEVELOPMENT_TEAM = W3LHX5RGV2;
297297
INFOPLIST_FILE = PresentationLayerTest/Info.plist;
298-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
298+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
299299
LD_RUNPATH_SEARCH_PATHS = (
300300
"$(inherited)",
301301
"@executable_path/Frameworks",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1300"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "81DB95DC1F49F72A005550D2"
18+
BuildableName = "PresentationLayerTest.app"
19+
BlueprintName = "PresentationLayerTest"
20+
ReferencedContainer = "container:PresentationLayerTest.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "81DB95DC1F49F72A005550D2"
48+
BuildableName = "PresentationLayerTest.app"
49+
BlueprintName = "PresentationLayerTest"
50+
ReferencedContainer = "container:PresentationLayerTest.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "81DB95DC1F49F72A005550D2"
65+
BuildableName = "PresentationLayerTest.app"
66+
BlueprintName = "PresentationLayerTest"
67+
ReferencedContainer = "container:PresentationLayerTest.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

bk2ch04p125imageViewAnimation/ch17p473imageViewAnimation.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@
275275
GCC_PRECOMPILE_PREFIX_HEADER = YES;
276276
GCC_PREFIX_HEADER = "ch17p473imageViewAnimation/ch17p473imageViewAnimation-Prefix.pch";
277277
INFOPLIST_FILE = "ch17p473imageViewAnimation/ch17p473imageViewAnimation-Info.plist";
278-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
278+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
279279
LD_RUNPATH_SEARCH_PATHS = (
280280
"$(inherited)",
281281
"@executable_path/Frameworks",
@@ -297,7 +297,7 @@
297297
GCC_PRECOMPILE_PREFIX_HEADER = YES;
298298
GCC_PREFIX_HEADER = "ch17p473imageViewAnimation/ch17p473imageViewAnimation-Prefix.pch";
299299
INFOPLIST_FILE = "ch17p473imageViewAnimation/ch17p473imageViewAnimation-Info.plist";
300-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
300+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
301301
LD_RUNPATH_SEARCH_PATHS = (
302302
"$(inherited)",
303303
"@executable_path/Frameworks",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1300"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "C9C94FD317B5621300719F08"
18+
BuildableName = "ch17p473imageViewAnimation.app"
19+
BlueprintName = "ch17p473imageViewAnimation"
20+
ReferencedContainer = "container:ch17p473imageViewAnimation.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "C9C94FD317B5621300719F08"
48+
BuildableName = "ch17p473imageViewAnimation.app"
49+
BlueprintName = "ch17p473imageViewAnimation"
50+
ReferencedContainer = "container:ch17p473imageViewAnimation.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "C9C94FD317B5621300719F08"
65+
BuildableName = "ch17p473imageViewAnimation.app"
66+
BlueprintName = "ch17p473imageViewAnimation"
67+
ReferencedContainer = "container:ch17p473imageViewAnimation.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

bk2ch04p130viewAnimation/bk2ch04p130viewAnimation.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@
264264
buildSettings = {
265265
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
266266
INFOPLIST_FILE = bk2ch04p130viewAnimation/Info.plist;
267-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
267+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
268268
LD_RUNPATH_SEARCH_PATHS = (
269269
"$(inherited)",
270270
"@executable_path/Frameworks",
@@ -280,7 +280,7 @@
280280
buildSettings = {
281281
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
282282
INFOPLIST_FILE = bk2ch04p130viewAnimation/Info.plist;
283-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
283+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
284284
LD_RUNPATH_SEARCH_PATHS = (
285285
"$(inherited)",
286286
"@executable_path/Frameworks",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1300"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "32B800B119BE13F800965954"
18+
BuildableName = "bk2ch04p130viewAnimation.app"
19+
BlueprintName = "bk2ch04p130viewAnimation"
20+
ReferencedContainer = "container:bk2ch04p130viewAnimation.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "32B800B119BE13F800965954"
48+
BuildableName = "bk2ch04p130viewAnimation.app"
49+
BlueprintName = "bk2ch04p130viewAnimation"
50+
ReferencedContainer = "container:bk2ch04p130viewAnimation.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "32B800B119BE13F800965954"
65+
BuildableName = "bk2ch04p130viewAnimation.app"
66+
BlueprintName = "bk2ch04p130viewAnimation"
67+
ReferencedContainer = "container:bk2ch04p130viewAnimation.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

bk2ch04p130viewAnimation/bk2ch04p130viewAnimation/ViewController.swift

+24-23
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ class ViewController: UIViewController {
5555
print(0)
5656
print(self.v.center.y)
5757
switch which {
58-
case 0:
59-
UIView.beginAnimations(nil, context: nil)
60-
UIView.setAnimationDuration(1)
61-
self.v.backgroundColor = .red
62-
UIView.commitAnimations()
58+
case 0: break
59+
// UIView.beginAnimations(nil, context: nil)
60+
// UIView.setAnimationDuration(1)
61+
// self.v.backgroundColor = .red
62+
// UIView.commitAnimations()
63+
// never mind
6364
case 1:
6465
UIView.animate(withDuration:2) {
6566
self.v.backgroundColor = .red
@@ -246,15 +247,15 @@ class ViewController: UIViewController {
246247
self.v.center.x = xorig
247248
}
248249
// can't figure out how to reproduce that using property animator
249-
case 13:
250-
let opts : UIView.AnimationOptions = .autoreverse
251-
let xorig = self.v.center.x
252-
UIView.animate(withDuration:1, delay: 0, options: opts) {
253-
UIView.setAnimationRepeatCount(3) // *
254-
self.v.center.x += 100
255-
} completion: { _ in
256-
self.v.center.x = xorig
257-
}
250+
case 13: break
251+
// let opts : UIView.AnimationOptions = .autoreverse
252+
// let xorig = self.v.center.x
253+
// UIView.animate(withDuration:1, delay: 0, options: opts) {
254+
// UIView.setAnimationRepeatCount(3) // *
255+
// self.v.center.x += 100
256+
// } completion: { _ in
257+
// self.v.center.x = xorig
258+
// }
258259
case 14:
259260
// new iOS 13 solution, though actually it seems to read back into iOS 12
260261
let xorig = self.v.center.x
@@ -357,15 +358,15 @@ class ViewController: UIViewController {
357358

358359
func animate(count:Int) {
359360
switch whichAnimateWay {
360-
case 1:
361-
let opts = UIView.AnimationOptions.autoreverse
362-
let xorig = self.v.center.x
363-
UIView.animate(withDuration:1, delay: 0, options: opts) {
364-
UIView.setAnimationRepeatCount(Float(count)) // I really don't like this
365-
self.v.center.x += 100
366-
} completion: { _ in
367-
self.v.center.x = xorig
368-
}
361+
case 1: break
362+
// let opts = UIView.AnimationOptions.autoreverse
363+
// let xorig = self.v.center.x
364+
// UIView.animate(withDuration:1, delay: 0, options: opts) {
365+
// UIView.setAnimationRepeatCount(Float(count)) // I really don't like this
366+
// self.v.center.x += 100
367+
// } completion: { _ in
368+
// self.v.center.x = xorig
369+
// }
369370
case 2:
370371
let opts = UIView.AnimationOptions.autoreverse
371372
let xorig = self.v.center.x

bk2ch04p130viewAnimationWithMask/MaskViewTest.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
buildSettings = {
263263
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
264264
INFOPLIST_FILE = MaskViewTest/Info.plist;
265-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
265+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
266266
LD_RUNPATH_SEARCH_PATHS = (
267267
"$(inherited)",
268268
"@executable_path/Frameworks",
@@ -278,7 +278,7 @@
278278
buildSettings = {
279279
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
280280
INFOPLIST_FILE = MaskViewTest/Info.plist;
281-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
281+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
282282
LD_RUNPATH_SEARCH_PATHS = (
283283
"$(inherited)",
284284
"@executable_path/Frameworks",

0 commit comments

Comments
 (0)