A library of handy SwiftUI components. Keep growing.
Add Swift Package Dependency in Xcode, and enter URL https://github.com/antoniokly/HandySwiftUI
.package(url: "https://github.com/antoniokly/HandySwiftUI.git", from: "0.0.1")
Import HandySwiftUI
Text("text").push {
SomeView()
}.foregroundColor(.red)
// is equivalent to
NavigationLink(destination: SomeView()) {
Text("text").foregroundColor(.red)
}
VStack {
Text("text")
Text("text1")
}.watchOS { $0
.font(.system(size: 12, weight: .light))
.foregroundColor(.blue)
}.iOS { $0
.font(.system(size: 16, weight: .bold))
}
Toggle(isOn: .constant(true)) {
Text("Text")
}.toggleStyle(CustomToggleStyle(onText: "開", offText: "關", onColor: .red))
PageView(pageCount: 5, currentPage: $currentPage, isNavigating: $isNavigating) { index in
if index == 0 {
Color.gray.edgesIgnoringSafeArea(.all)
} else if index == 1 {
Text("Page 2")
} else {
Text("More Page")
}
}.indicator(currentPageSize: 10, defaultSize: 5, currentPageColor: .accentColor, defaultColor: .orange, opacity: 0.8)
watchOS and tvOS may have some issues using Swift Package, the supplied framework project is a solution to that at the moment.