Skip to content

Commit 2b9d9d3

Browse files
committed
forgot to update walk-responder-chain code
1 parent e0bf171 commit 2b9d9d3

File tree

3 files changed

+93
-3
lines changed

3 files changed

+93
-3
lines changed

bk2ch23p824peopleGroupsCoreData/ch36p1079peopleGroupsCoreData/PeopleLister.swift

+13-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ func delay(_ delay:Double, closure:@escaping ()->()) {
88
DispatchQueue.main.asyncAfter(deadline: when, execute: closure)
99
}
1010

11+
extension UIResponder {
12+
func next<T:UIResponder>(ofType: T.Type) -> T? {
13+
let r = self.next
14+
if let r = r as? T ?? r?.next(ofType: T.self) {
15+
return r
16+
} else {
17+
return nil
18+
}
19+
}
20+
}
21+
22+
1123

1224
class PeopleLister: UITableViewController, NSFetchedResultsControllerDelegate, UITextFieldDelegate {
1325

@@ -93,9 +105,7 @@ class PeopleLister: UITableViewController, NSFetchedResultsControllerDelegate, U
93105

94106
func textFieldDidEndEditing(_ textField: UITextField) {
95107
print("did end editing")
96-
var v : UIView = textField
97-
repeat { v = v.superview! } while !(v is UITableViewCell)
98-
let cell = v as! UITableViewCell
108+
guard let cell = textField.next(ofType: UITableViewCell.self) else { return }
99109
let ip = self.tableView.indexPath(for:cell)!
100110
let object = self.frc.object(at:ip)
101111
object.setValue(textField.text!, forKey: ((textField.tag == 1) ? "firstName" : "lastName"))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1200"
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 = "812930B71DB1A439007806F6"
18+
BuildableName = "ODRTest.app"
19+
BlueprintName = "ODRTest"
20+
ReferencedContainer = "container:ODRTest.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 = "812930B71DB1A439007806F6"
48+
BuildableName = "ODRTest.app"
49+
BlueprintName = "ODRTest"
50+
ReferencedContainer = "container:ODRTest.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 = "812930B71DB1A439007806F6"
65+
BuildableName = "ODRTest.app"
66+
BlueprintName = "ODRTest"
67+
ReferencedContainer = "container:ODRTest.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>

bk2ch26p878undoableDrag4/ch39p1123undoableDrag4.xcodeproj/project.pbxproj

+2
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@
260260
buildSettings = {
261261
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
262262
CLANG_ENABLE_MODULES = YES;
263+
DEVELOPMENT_TEAM = W3LHX5RGV2;
263264
GCC_PRECOMPILE_PREFIX_HEADER = YES;
264265
GCC_PREFIX_HEADER = "ch39p1123undoableDrag/ch39p1123undoableDrag4-Prefix.pch";
265266
INFOPLIST_FILE = "$(SRCROOT)/ch39p1123undoableDrag/Info.plist";
@@ -282,6 +283,7 @@
282283
buildSettings = {
283284
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
284285
CLANG_ENABLE_MODULES = YES;
286+
DEVELOPMENT_TEAM = W3LHX5RGV2;
285287
GCC_PRECOMPILE_PREFIX_HEADER = YES;
286288
GCC_PREFIX_HEADER = "ch39p1123undoableDrag/ch39p1123undoableDrag4-Prefix.pch";
287289
INFOPLIST_FILE = "$(SRCROOT)/ch39p1123undoableDrag/Info.plist";

0 commit comments

Comments
 (0)