Skip to content

Commit 5acb006

Browse files
committed
Add an example of UIRefreshControl
1 parent b2d3984 commit 5acb006

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

ScrollEdgeControl-Demo/Book.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,10 @@ let book = Book(title: "MyBook") {
7171
}
7272

7373
}
74+
75+
BookNavigationLink(title: "UIRefreshControl") {
76+
BookPush(title: "Vertical") {
77+
DemoUIRefreshViewController()
78+
}
79+
}
7480
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import Foundation
2+
import UIKit
3+
import MondrianLayout
4+
import StorybookUI
5+
import StackScrollView
6+
import ScrollEdgeControl
7+
8+
final class DemoUIRefreshViewController: UIViewController {
9+
10+
private let scrollView = StackScrollView()
11+
12+
init() {
13+
14+
super.init(nibName: nil, bundle: nil)
15+
16+
}
17+
18+
required init?(coder: NSCoder) {
19+
fatalError("init(coder:) has not been implemented")
20+
}
21+
22+
override func viewDidLoad() {
23+
super.viewDidLoad()
24+
let scrollView = self.scrollView
25+
26+
view.backgroundColor = .white
27+
28+
view.mondrian.buildSubviews {
29+
HStackBlock {
30+
scrollView
31+
}
32+
}
33+
34+
let cells = (0..<(20)).map { _ in
35+
Components.makeDemoCell()
36+
}
37+
38+
scrollView.append(views: cells)
39+
40+
let control = UIRefreshControl()
41+
42+
scrollView.addSubview(control)
43+
44+
}
45+
46+
}

ScrollEdgeControl.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
4BC42850275158F80047A850 /* RxCocoa in Frameworks */ = {isa = PBXBuildFile; productRef = 4BC4284F275158F80047A850 /* RxCocoa */; };
3535
4BC42852275158F80047A850 /* RxRelay in Frameworks */ = {isa = PBXBuildFile; productRef = 4BC42851275158F80047A850 /* RxRelay */; };
3636
4BC42854275158F80047A850 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 4BC42853275158F80047A850 /* RxSwift */; };
37+
4BD5536329D5D51400A1EBF3 /* DemoUIRefreshViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD5536229D5D51400A1EBF3 /* DemoUIRefreshViewController.swift */; };
3738
C400406E29C1A0F1004A834D /* UIControl+Closure.swift in Sources */ = {isa = PBXBuildFile; fileRef = C400406D29C1A0F1004A834D /* UIControl+Closure.swift */; };
3839
/* End PBXBuildFile section */
3940

@@ -80,6 +81,7 @@
8081
4BC42843275158250047A850 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
8182
4BC42846275158250047A850 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
8283
4BC42848275158250047A850 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
84+
4BD5536229D5D51400A1EBF3 /* DemoUIRefreshViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoUIRefreshViewController.swift; sourceTree = "<group>"; };
8385
C400406D29C1A0F1004A834D /* UIControl+Closure.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Closure.swift"; sourceTree = "<group>"; };
8486
/* End PBXFileReference section */
8587

@@ -181,6 +183,7 @@
181183
4BC42845275158250047A850 /* LaunchScreen.storyboard */,
182184
4BC42848275158250047A850 /* Info.plist */,
183185
4B39D05627528ACD00D013F4 /* Components.swift */,
186+
4BD5536229D5D51400A1EBF3 /* DemoUIRefreshViewController.swift */,
184187
);
185188
path = "ScrollEdgeControl-Demo";
186189
sourceTree = "<group>";
@@ -338,6 +341,7 @@
338341
4B39D05727528ACD00D013F4 /* Components.swift in Sources */,
339342
C400406E29C1A0F1004A834D /* UIControl+Closure.swift in Sources */,
340343
4B39D0512752745C00D013F4 /* DemoHorizontalViewController.swift in Sources */,
344+
4BD5536329D5D51400A1EBF3 /* DemoUIRefreshViewController.swift in Sources */,
341345
4B39D05527528A1900D013F4 /* DebuggingRefreshIndicatorView.swift in Sources */,
342346
4B98480B27F33CB000ED3FA9 /* DemoVerticalStickyHeaderViewController.swift in Sources */,
343347
);
@@ -548,6 +552,7 @@
548552
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
549553
CODE_SIGN_STYLE = Automatic;
550554
CURRENT_PROJECT_VERSION = 1;
555+
DEVELOPMENT_TEAM = JX92XL88RZ;
551556
GENERATE_INFOPLIST_FILE = YES;
552557
INFOPLIST_FILE = "ScrollEdgeControl-Demo/Info.plist";
553558
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
@@ -575,6 +580,7 @@
575580
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
576581
CODE_SIGN_STYLE = Automatic;
577582
CURRENT_PROJECT_VERSION = 1;
583+
DEVELOPMENT_TEAM = JX92XL88RZ;
578584
GENERATE_INFOPLIST_FILE = YES;
579585
INFOPLIST_FILE = "ScrollEdgeControl-Demo/Info.plist";
580586
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;

0 commit comments

Comments
 (0)