Skip to content

Commit 42347eb

Browse files
committed
Format
1 parent 8a83872 commit 42347eb

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: macOS-latest
77
strategy:
88
matrix:
9-
destination: ['platform=iOS Simulator,OS=14.0,name=iPhone 11 Pro Max']
9+
destination: ['platform=iOS Simulator,OS=latest,name=iPhone 12 Pro']
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@master

LeakDetectorDemo/Leak/Delegate/DelegateViewController.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ extension DelegateViewController1: LeakDelegate {
3131
}
3232
}
3333

34-
3534
// MARK: - No Leak Case 1
3635

3736
class NoLeakDelegateViewController1: ChildViewController {
@@ -62,7 +61,7 @@ class NoLeakDelegateViewController2: ChildViewController, UITableViewDelegate, U
6261
override func viewDidLoad() {
6362
super.viewDidLoad()
6463

65-
self.view.addSubview(tableView)
64+
view.addSubview(tableView)
6665

6766
tableView.delegate = self
6867
tableView.dataSource = self

LeakDetectorDemo/Leak/LazyVar/LazyVarViewController.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//
2-
// LazyVarViewController.swift
3-
// LeakDetectorDemo
4-
//
5-
// Created by An Tran on 28/11/20.
2+
// Copyright © 2020 An Tran. All rights reserved.
63
//
74

85
import Foundation

LeakDetectorDemo/Leak/RxSwift/RxViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class RxSwiftViewController2: ChildViewController {
3434

3535
private let disposeBag = DisposeBag()
3636
private lazy var button = {
37-
UIButton()
37+
UIButton()
3838
}()
3939

4040
override func viewDidLoad() {
@@ -74,7 +74,7 @@ class NoLeakRxSwiftViewController2: ChildViewController {
7474

7575
private let disposeBag = DisposeBag()
7676
private lazy var button = {
77-
UIButton()
77+
UIButton()
7878
}()
7979

8080
override func viewDidLoad() {

LeakDetectorDemo/Leak/SimpleCases/SimpleCasesViewController.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
//
2-
// SimpleCasesViewController.swift
3-
// LeakDetectorDemo
4-
//
5-
// Created by An Tran on 29/11/20.
2+
// Copyright © 2020 An Tran. All rights reserved.
63
//
74

85
import Foundation
96
import UIKit
107

118
// MARK: - Leak: Case 1:
9+
1210
// https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html#//apple_ref/doc/uid/TP40014097-CH20-ID48
1311

1412
class Person {
@@ -116,4 +114,3 @@ class NoLeakSimpleCasesViewController1: LeakDetectableViewController {
116114
}
117115

118116
}
119-

LeakDetectorDemo/Utils/ChildViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class ChildViewController: UIViewController {
1515
super.init(nibName: nil, bundle: nil)
1616
}
1717

18+
@available(*, unavailable)
1819
required init?(coder: NSCoder) {
1920
fatalError("init(coder:) has not been implemented")
2021
}

LeakDetectorDemoUITests/LeakTests.swift

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,33 @@ class LeakTests: XCTestCase {
2222
func testLeakByDelegate() throws {
2323
assert(
2424
testCase: "Leak by delegate",
25+
subcase: "Leak - 1",
2526
exitAction: {
26-
self.app.navigationBars["Delegate"].buttons["Leak Detector Demo"].tap()
27-
}
27+
app.buttons["Go Back"].tap()
28+
},
29+
timeout: .viewDisappearExpectation + 0.5
2830
)
2931
}
3032

3133
func testLeakByObservables() throws {
3234
assert(
3335
testCase: "Leak by observables",
36+
subcase: "Leak - 1",
3437
exitAction: {
35-
self.app.navigationBars["Observables"].buttons["Leak Detector Demo"].tap()
36-
}
38+
app.buttons["Go Back"].tap()
39+
},
40+
timeout: .viewDisappearExpectation + 0.5
3741
)
3842
}
3943

4044
func testLeakByCombine() throws {
4145
assert(
42-
testCase: "Leak by assign in Combine",
46+
testCase: "Leak by Combine",
47+
subcase: "Leak - Combine assign",
4348
exitAction: {
44-
self.app.navigationBars["Combine Assign"].buttons["Leak Detector Demo"].tap()
45-
}
49+
app.buttons["Go Back"].tap()
50+
},
51+
timeout: .viewDisappearExpectation + 0.5
4652
)
4753
}
4854

@@ -68,10 +74,10 @@ class LeakTests: XCTestCase {
6874
)
6975
}
7076

71-
func testLeakByNestedClosures() throws {
77+
func testLeakBySimplelosures() throws {
7278
assert(
7379
testCase: "Leak by Closure",
74-
subcase: "Leak by Nested Closures",
80+
subcase: "Leak by Simple Closure",
7581
exitAction: {
7682
app.buttons["Go Back"].tap()
7783
},

0 commit comments

Comments
 (0)