From 5acb006d652c8c6cb64e97c47799c46a832f7278 Mon Sep 17 00:00:00 2001 From: Muukii Date: Thu, 30 Mar 2023 23:40:48 +0900 Subject: [PATCH] Add an example of UIRefreshControl --- ScrollEdgeControl-Demo/Book.swift | 6 +++ .../DemoUIRefreshViewController.swift | 46 +++++++++++++++++++ ScrollEdgeControl.xcodeproj/project.pbxproj | 6 +++ 3 files changed, 58 insertions(+) create mode 100644 ScrollEdgeControl-Demo/DemoUIRefreshViewController.swift diff --git a/ScrollEdgeControl-Demo/Book.swift b/ScrollEdgeControl-Demo/Book.swift index e6049fd..5230537 100644 --- a/ScrollEdgeControl-Demo/Book.swift +++ b/ScrollEdgeControl-Demo/Book.swift @@ -71,4 +71,10 @@ let book = Book(title: "MyBook") { } } + + BookNavigationLink(title: "UIRefreshControl") { + BookPush(title: "Vertical") { + DemoUIRefreshViewController() + } + } } diff --git a/ScrollEdgeControl-Demo/DemoUIRefreshViewController.swift b/ScrollEdgeControl-Demo/DemoUIRefreshViewController.swift new file mode 100644 index 0000000..e81aa75 --- /dev/null +++ b/ScrollEdgeControl-Demo/DemoUIRefreshViewController.swift @@ -0,0 +1,46 @@ +import Foundation +import UIKit +import MondrianLayout +import StorybookUI +import StackScrollView +import ScrollEdgeControl + +final class DemoUIRefreshViewController: UIViewController { + + private let scrollView = StackScrollView() + + init() { + + super.init(nibName: nil, bundle: nil) + + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func viewDidLoad() { + super.viewDidLoad() + let scrollView = self.scrollView + + view.backgroundColor = .white + + view.mondrian.buildSubviews { + HStackBlock { + scrollView + } + } + + let cells = (0..<(20)).map { _ in + Components.makeDemoCell() + } + + scrollView.append(views: cells) + + let control = UIRefreshControl() + + scrollView.addSubview(control) + + } + +} diff --git a/ScrollEdgeControl.xcodeproj/project.pbxproj b/ScrollEdgeControl.xcodeproj/project.pbxproj index 5895f07..be750e3 100644 --- a/ScrollEdgeControl.xcodeproj/project.pbxproj +++ b/ScrollEdgeControl.xcodeproj/project.pbxproj @@ -34,6 +34,7 @@ 4BC42850275158F80047A850 /* RxCocoa in Frameworks */ = {isa = PBXBuildFile; productRef = 4BC4284F275158F80047A850 /* RxCocoa */; }; 4BC42852275158F80047A850 /* RxRelay in Frameworks */ = {isa = PBXBuildFile; productRef = 4BC42851275158F80047A850 /* RxRelay */; }; 4BC42854275158F80047A850 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 4BC42853275158F80047A850 /* RxSwift */; }; + 4BD5536329D5D51400A1EBF3 /* DemoUIRefreshViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD5536229D5D51400A1EBF3 /* DemoUIRefreshViewController.swift */; }; C400406E29C1A0F1004A834D /* UIControl+Closure.swift in Sources */ = {isa = PBXBuildFile; fileRef = C400406D29C1A0F1004A834D /* UIControl+Closure.swift */; }; /* End PBXBuildFile section */ @@ -80,6 +81,7 @@ 4BC42843275158250047A850 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 4BC42846275158250047A850 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 4BC42848275158250047A850 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 4BD5536229D5D51400A1EBF3 /* DemoUIRefreshViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoUIRefreshViewController.swift; sourceTree = ""; }; C400406D29C1A0F1004A834D /* UIControl+Closure.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Closure.swift"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -181,6 +183,7 @@ 4BC42845275158250047A850 /* LaunchScreen.storyboard */, 4BC42848275158250047A850 /* Info.plist */, 4B39D05627528ACD00D013F4 /* Components.swift */, + 4BD5536229D5D51400A1EBF3 /* DemoUIRefreshViewController.swift */, ); path = "ScrollEdgeControl-Demo"; sourceTree = ""; @@ -338,6 +341,7 @@ 4B39D05727528ACD00D013F4 /* Components.swift in Sources */, C400406E29C1A0F1004A834D /* UIControl+Closure.swift in Sources */, 4B39D0512752745C00D013F4 /* DemoHorizontalViewController.swift in Sources */, + 4BD5536329D5D51400A1EBF3 /* DemoUIRefreshViewController.swift in Sources */, 4B39D05527528A1900D013F4 /* DebuggingRefreshIndicatorView.swift in Sources */, 4B98480B27F33CB000ED3FA9 /* DemoVerticalStickyHeaderViewController.swift in Sources */, ); @@ -548,6 +552,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = JX92XL88RZ; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "ScrollEdgeControl-Demo/Info.plist"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -575,6 +580,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = JX92XL88RZ; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "ScrollEdgeControl-Demo/Info.plist"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;