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())  
Protocol
- SliderValue (e.g. for use enum in Slider)
 
Extension
- SwiftUI 
  
- View 
    
toggleSidebar()hideKeyboard()when() { view in ... } 
 - ViewModifier 
    
toggleSidebar()hideKeyboard()
 - Binding 
    
optionalBinding() -> BindingsliderBinding() -> Bindingwhere Value: SliderValue 
 
 - View 
    
 - AppKit 
  
- NSApplication 
    
toggleSidebar()
 
 - NSApplication 
    
 - UIKit 
  
- UIApplication 
    
hideKeyboard()
 
 - UIApplication 
    
 - Foundation 
  
- Task 
    
sleep(seconds: UInt64) async throwssleep(milliseconds: UInt64) async throws
 
 - Task 
    
 
Install
If you want.
let package = Package(
    dependencies: [
        .package(url: "https://github.com/YusukeHosonuma/SwiftUI-Common.git", from: "0.3.0"),
    ],
    targets: [
        .target(name: "" , dependencies: [
             .product(name: "SwiftUICommon", package: "SwiftUI-Common"),
        ]),
    ]
)
Links
- This library is used in the following:
 - Document (Japanese):
 
Author
Yusuke Hosonuma / @tobi462