-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from 0xLeif/develop
Added Later (v2.0.0)
- Loading branch information
Showing
18 changed files
with
406 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
/*.xcodeproj | ||
xcuserdata/ | ||
build | ||
*.resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Sources/SwiftUIKit/Extensions/UIAppearance+SwiftUIKit.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// UIAppearance+SwiftUIKit.swift | ||
// | ||
// | ||
// Created by Zach Eriksen on 8/25/20. | ||
// | ||
|
||
import UIKit | ||
import Later | ||
|
||
@available(iOS 9.0, *) | ||
public extension UIAppearance where Self: UIView { | ||
func contract<Value>(_ closure: (Self) -> Contract<Value>) -> ContractView<Self, Value> { | ||
ContractView(view: self) { view in | ||
closure(view) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// UILabel+SwiftUIKit.swift | ||
// SwiftUIKit | ||
// | ||
// Created by Zach Eriksen on 7/7/20. | ||
// | ||
|
||
import UIKit | ||
|
||
public extension UILabel { | ||
@discardableResult | ||
func text(color: UIColor?) -> Self { | ||
textColor = color | ||
|
||
return self | ||
} | ||
|
||
@discardableResult | ||
func text(_ value: String?) -> Self { | ||
text = value | ||
|
||
return self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// | ||
// UIView+Later.swift | ||
// SwiftUIKit | ||
// | ||
// Created by Zach Eriksen on 8/26/20. | ||
// | ||
|
||
import UIKit | ||
import Later | ||
|
||
@available(iOS 9.0, *) | ||
public extension UIView { | ||
static func later(_ laterView: (Later.Type) -> LaterValue<UIView>) -> UIView { | ||
let view = UIView() | ||
|
||
view.center { | ||
LoadingView() | ||
.start() | ||
} | ||
|
||
laterView(Later.self) | ||
.whenSuccess { embeddedView in | ||
Later.main { | ||
view.clear() | ||
.embed { | ||
embeddedView | ||
} | ||
} | ||
|
||
} | ||
|
||
return view | ||
} | ||
|
||
static func later(centeredLoadingView: UIView, | ||
withSize size: CGSize? = nil, | ||
_ laterView: (Later.Type) -> LaterValue<UIView>) -> UIView { | ||
|
||
let view = UIView() | ||
|
||
view.center { | ||
centeredLoadingView | ||
.configure { | ||
if let size = size { | ||
$0.frame(height: Float(size.height), | ||
width: Float(size.width)) | ||
} | ||
} | ||
} | ||
|
||
laterView(Later.self) | ||
.whenSuccess { embeddedView in | ||
Later.main { | ||
view.clear() | ||
.embed { | ||
embeddedView | ||
} | ||
} | ||
|
||
} | ||
|
||
return view | ||
} | ||
|
||
static func later(embeddedLoadingView: UIView, | ||
withPadding padding: Float = 0, | ||
_ laterView: (Later.Type) -> LaterValue<UIView>) -> UIView { | ||
let view = UIView() | ||
|
||
view.embed(withPadding: padding) { | ||
embeddedLoadingView | ||
} | ||
|
||
laterView(Later.self) | ||
.whenSuccess { embeddedView in | ||
Later.main { | ||
view.clear() | ||
.embed { | ||
embeddedView | ||
} | ||
} | ||
|
||
} | ||
|
||
return view | ||
} | ||
} |
Oops, something went wrong.