Skip to content

Commit 6cc94ee

Browse files
committed
minor
1 parent f971d93 commit 6cc94ee

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

bk1ch03p069computedVariables/bk1ch03p069computedVariables/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class ViewController: UIViewController {
7272
get {
7373
if _myBigData == nil {
7474
let fm = FileManager.default
75-
let f = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("myBigData")
75+
let f = fm.temporaryDirectory.appendingPathComponent("myBigData")
7676
if let d = try? Data(contentsOf:f) {
7777
print("loaded big data from disk")
7878
self._myBigData = d

bk2ch06p301customAnimation4/NavCustomPushTest/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ extension AppDelegate {
4747
case .ended:
4848
let anim = self.anim as! UIViewPropertyAnimator
4949
let ctx = self.context!
50+
let vc2 = ctx.viewController(forKey:.to)!
5051
anim.addAnimations {
51-
let vc2 = ctx.viewController(forKey:.to)!
5252
v.frame = ctx.finalFrame(for: vc2)
5353
}
5454
let factor = 1 - anim.fractionComplete

bk2ch06p301customAnimation4/NavCustomPushTest/MasterViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class MasterViewController : UITableViewController {
4848
}
4949

5050
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
51-
print(self.tableView.indexPathForSelectedRow)
51+
print(self.tableView.indexPathForSelectedRow as Any)
5252
if let dest = segue.destination as? DetailViewController {
5353
let cm = self.model[self.lastSelection.row]
5454
dest.detailItem = UIImage(named:cm.name)

bk2ch06p336memoryWarning/ch19p647memoryWarning/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class ViewController : UIViewController {
5454
get {
5555
if _myBigData == nil {
5656
let fm = FileManager.default
57-
let f = URL(fileURLWithPath: NSTemporaryDirectory())
58-
.appendingPathComponent("myBigData")
57+
let f = fm.temporaryDirectory.appendingPathComponent("myBigData")
5958
if let d = try? Data(contentsOf:f) {
6059
print("loaded big data from disk")
6160
self._myBigData = d
@@ -91,7 +90,8 @@ class ViewController : UIViewController {
9190
func saveAndReleaseMyBigData() {
9291
if let myBigData = self.myBigData {
9392
print("unloading big data")
94-
let f = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("myBigData")
93+
let fm = FileManager.default
94+
let f = fm.temporaryDirectory.appendingPathComponent("myBigData")
9595
try? myBigData.write(to:f)
9696
self.myBigData = nil
9797
}

0 commit comments

Comments
 (0)