https://github.com/antoniokly/HandySwiftUI
https://github.com/antoniokly/HandySwiftUI
ios macos swiftui swiftui-components tvos ui watchos
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/antoniokly/HandySwiftUI
- Owner: antoniokly
- License: mit
- Created: 2020-05-23T04:14:30.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-30T10:47:44.000Z (almost 6 years ago)
- Last Synced: 2024-10-23T22:18:06.796Z (over 1 year ago)
- Topics: ios, macos, swiftui, swiftui-components, tvos, ui, watchos
- Language: Swift
- Size: 127 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)
[](https://developer.apple.com/documentation/swiftui)
[](https://github.com/antoniokly/HandySwiftUI/blob/master/LICENSE)
# HandySwiftUI
A library of handy SwiftUI components. Keep growing.
## Installation
Add Swift Package Dependency in Xcode, and enter URL ```https://github.com/antoniokly/HandySwiftUI```
```swift
.package(url: "https://github.com/antoniokly/HandySwiftUI.git", from: "0.0.1")
```
## Usage
```swift
Import HandySwiftUI
```
### Push
```swift
Text("text").push {
SomeView()
}.foregroundColor(.red)
// is equivalent to
NavigationLink(destination: SomeView()) {
Text("text").foregroundColor(.red)
}
```
### Platform Specific
```swift
VStack {
Text("text")
Text("text1")
}.watchOS { $0
.font(.system(size: 12, weight: .light))
.foregroundColor(.blue)
}.iOS { $0
.font(.system(size: 16, weight: .bold))
}
```
### CustomToggleStyle

```swift
Toggle(isOn: .constant(true)) {
Text("Text")
}.toggleStyle(CustomToggleStyle(onText: "開", offText: "關", onColor: .red))
```
### PageView

```swift
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)
```
## Known Issues
watchOS and tvOS may have some issues using Swift Package, the supplied framework project is a solution to that at the moment.
## Donation
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UXRR2S35YMCQC&source=url)