SwiftUI-Common
SwiftUI components and extensions that seem to be highly reusable.
Since this is an experimental library, we recommend that you copy (or use as refererence) and use the source.
View
- Common
- TextEdit (add placeholder to TextEditor)
- WebView (bridge to WKWebView)
- AppKit
- WindowController (bridge to NSWindowController)
- UIKit
- ActivityView (bridge to UIActivityViewController)
Modifier
- EnabledModifier (
.enabled(<condition>)
)
Protocol
- SliderValue (e.g. for use enum in Slider)
Extension
- SwiftUI
- View
toggleSidebar()
hideKeyboard()
- ViewModifier
toggleSidebar()
hideKeyboard()
- Binding
optionalBinding() -> Binding<Value?>
sliderBinding() -> Binding<Double> where Value: SliderValue
- View
- AppKit
- NSApplication
toggleSidebar()
- NSApplication
- UIKit
- UIApplication
hideKeyboard()
- UIApplication
- Foundation
- Task
sleep(seconds: UInt64) async throws
sleep(milliseconds: UInt64) async throws
- Task
Install
If you want.
let package = Package(
dependencies: [
.package(url: "https://github.com/YusukeHosonuma/SwiftUI-Common.git", from: "0.1.0"),
],
targets: [
.target(name: "<your-target-name>", dependencies: [
.product(name: "SwiftUICommon", package: "SwiftUI-Common"),
]),
]
)
Links
- This library is used in the following:
- Document (Japanese):
Author
Yusuke Hosonuma / @tobi462