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

Modifier

Protocol

Extension

  • SwiftUI
    • View
      • toggleSidebar()
      • hideKeyboard()
    • ViewModifier
      • toggleSidebar()
      • hideKeyboard()
    • Binding
      • optionalBinding() -> Binding<Value?>
      • sliderBinding() -> Binding<Double> where Value: SliderValue
  • AppKit
  • UIKit
  • Foundation
    • Task
      • sleep(seconds: UInt64) async throws
      • sleep(milliseconds: UInt64) async throws

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

Author

Yusuke Hosonuma / @tobi462

GitHub

View Github