https://github.com/sparrowcode/uikitextension
https://github.com/sparrowcode/uikitextension
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sparrowcode/uikitextension
- Owner: sparrowcode
- License: mit
- Created: 2021-08-15T10:17:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-24T21:15:00.000Z (about 1 year ago)
- Last Synced: 2025-03-31T07:07:40.850Z (9 months ago)
- Language: Swift
- Homepage: https://sparrowcode.io/frameworks
- Size: 4.89 MB
- Stars: 91
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# NativeUIKit
Mimicrated views and controls to native Apple appearance. If you have any ideas of what elements can be added, let me know. Here provided all elements which available, tap for open docs for it.
If you like the project, don't forget to `put star ★`
Check out my other libraries:
## Navigate
- [Installation](#installation)
- [Swift Package Manager](#swift-package-manager)
- [Manually](#manually)
- [Classes](#usage)
- [NativeLargeActionButton](#NativeLargeActionButton)
- [NativeSmallActionButton](#NativeSmallActionButton)
- [NativeAvatarView](#NativeAvatarView)
- [NativePlayPauseCompactButton](#NativePlayPauseCompactButton)
- [Сontribution](#сontribution)
- [Other Projects](#other-projects)
- [Russian Community](#russian-community)
## Installation
Ready for use on iOS 12+, tvOS 12+ & watchOS 6.0+. Works with Swift 5+. Required Xcode 12.0 and higher.

### Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
To integrate using Xcode 12, specify it in `File > Swift Packages > Add Package Dependency...`:
```ogdl
https://github.com/ivanvorobei/NativeUIKit
```
### Manually
If you prefer not to use any of dependency managers, you can integrate manually. Put `Sources/NativeUIKit` folder in your Xcode project. Make sure to enable `Copy items if needed` and `Create groups`.
## Classes
### [NativeLargeActionButton](https://github.com/ivanvorobei/NativeUIKit/blob/main/Sources/NativeUIKit/NativeLargeActionButton.swift)
Usually used at the bottom of the screen. You can set an icon. You can set how to change the style when you click. Supports states `disabled` and `dimmed`.
Next code for usage:
```swift
// Set Appearance and Content
let button = NativeLargeActionButton()
button.setImage(UIImage.init(systemName: "plus.circle.fill")!)
button.higlightStyle = .background
button.applyDefaultAppearance(with: .init(content: .custom(.white), background: .tint))
// or use Wrapper
button.set(
title: "Large Action",
icon: UIImage.init(systemName: "plus.circle.fill")!,
colorise: .init(content: .custom(.white), background: .tint)
)
```
Button support system layouts by `sizeToFit()`. Next code allow you to layout button with cutom width:
```swift
button.sizeToFit()
button.frame = .init(x: 0, y: 0, width: 300, height: button.frame.height)
```
### [NativeSmallActionButton](https://github.com/ivanvorobei/NativeUIKit/blob/main/Sources/NativeUIKit/NativeSmallActionButton.swift)
You definitely saw this button in the AppStore. You can use it without the icon.
Supports states `disabled` and `dimmed`.
Next code for usage:
```swift
// Set Appearance and Content
let button = NativeSmallActionButton()
button.higlightStyle = .background
button.applyDefaultAppearance(with: .init(content: .custom(.white), background: .tint))
// or use Wrapper
button.set(
title: "Edit",
icon: nil,
colorise: .init(content: .custom(.white), background: .tint)
)
```
Button support system layouts by `sizeToFit()`. Next code allow you to layout button:
```swift
button.sizeToFit()
```
### [NativeAvatarView](https://github.com/ivanvorobei/NativeUIKit/blob/main/Sources/NativeUIKit/NativeAvatarView.swift)
Avatar view is container with 3 buttons - placeholder, avatar and indicator. For change avatar set `avatarAppearance`. For show or hide edit button set `isEditable`.
Layout availbe by size to fit for content. In this case change placeholder size to valid SFSymbol for have correct fit. By default font side is 80 point. Or you can set fixed frame and ignore fitting size.
```swift
let avatarView = NativeAvatarView()
// You can set target, actions or even contex menu like usual button.
avatarView.placeholderButton.addTarget(self, action: #selector(didTap), for: .touchUpInside)
avatarView.avatarButton.addTarget(self, action: #selector(didTap), for: .touchUpInside)
avatarView.indicatorButton.addTarget(self, action: #selector(didTap), for: .touchUpInside)
// For show edit button.
avatarView.isEditable = true
// Layout.
// For fit by images.
avatarView.sizeToFit()
// By custom frame:
avatarView.frame = .init(x: 0, y: 0, width: 60, height: 60)
```
### [NativePlayPauseCompactButton](https://github.com/ivanvorobei/NativeUIKit/blob/main/Sources/NativeUIKit/NativePlayPauseCompactButton.swift)
Simple play/pause button.
```swift
let button = NativePlayPauseCompactButton()
// For fit to valid size.
button.sizeToFit()
// For change appearance.
button.appearance = .play //.pause
```
## Сontribution
My English is very bad. You can see this once you read the documentation. I would really like to have clean and nice documentation. If you see gramatical errors and can help fix the Readme, please contact me hello@ivanvorobei.io or make a Pull Request. Thank you in advance!
## Other Projects
I love being helpful. Here I have provided a list of libraries that I keep up to date. For see `video previews` of libraries without install open [opensource.ivanvorobei.io](https://opensource.ivanvorobei.io) website.
I have libraries with native interface and managing permissions. Also available pack of useful extensions for boost your development process.
## Russian Community
Подписывайся в телеграмм-канал, если хочешь получать уведомления о новых туториалах.
Со сложными и непонятными задачами помогут в чате.
Видео-туториалы выклыдываю на [YouTube](https://tutorials.ivanvorobei.io/youtube):
[](https://tutorials.ivanvorobei.io/youtube)