SwiftUIX

SwiftUIX attempts to fill the gaps of SwiftUI, providing an extensive suite of components, extensions and utilities to complement the standard library. This project is by far the most complete port of missing UIKit/AppKit functionality, striving to deliver it in the most Apple-like fashion possible.
Why
The goal of this project is to complement the SwiftUI standard library, offering hundreds of extensions and views that empower you, the developer, to build applications with the ease promised by the revolution that is SwiftUI.
Requirements
- Swift Version: Swift 5.10+ (Swift 5.9 no longer supported)
- Deployment Targets: iOS 13, macOS 10.15, tvOS 13, watchOS 6, visionOS 1
- Xcode: 15.4+
Installation
Via Swift Package Manager:
// Package.swift
dependencies: [
.package(url: "https://github.com/SwiftUIX/SwiftUIX.git", branch: "master"),
]Or in Xcode: File → Swift Packages → Add Package Dependency, paste the repository URL, select Branch (master), then add SwiftUIX.framework to Linked Frameworks.
Documentation: swiftuix.github.io/SwiftUIX
UIKit → SwiftUI Components
- LPLinkView → LinkPresentationView
- UIActivityIndicatorView → ActivityIndicator
- UIActivityViewController → AppActivityView
- UIBlurEffect → BlurEffectView
- UICollectionView → CollectionView
- UIDeviceOrientation → DeviceLayoutOrientation
- UIImagePickerController → ImagePicker
- UIPageViewController → PaginationView
- UIScreen → Screen
- UISearchBar → SearchBar
- UIScrollView → CocoaScrollView
- UISwipeGestureRecognizer → SwipeGestureOverlay
- UITableView → CocoaList
- UITextField → CocoaTextField
- UIModalPresentationStyle → ModalPresentationStyle
- UIVisualEffectView → VisualEffectView
- UIWindow → WindowOverlay
Code Examples
ActivityIndicator
ActivityIndicator()
.animated(true)
.style(.large)AppActivityView
AppActivityView(activityItems: [...])
.excludeActivityTypes([...])
.onCancel { }
.onComplete { result in
foo(result)
}CollectionView
import SwiftUIX
struct MyCollectionView: View {
let data: [MyModel]
var body: some View {
CollectionView(data, id: \.self) { item in
Text(item.title)
}
}
}LinkPresentationView
LinkPresentationView(url: url)
.frame(height: 192)PaginationView
PaginationView(axis: .horizontal) {
ForEach(0..<10, id: \.hashValue) { index in
Text(String(index))
}
}
.currentPageIndex($...)
.pageIndicatorAlignment(...)
.pageIndicatorTintColor(...)
.currentPageIndicatorTintColor(...)SearchBar
struct ContentView: View {
@State var isEditing: Bool = false
@State var searchText: String = ""
var body: some View {
SearchBar("Search...", text: $searchText, isEditing: $isEditing)
.showsCancelButton(isEditing)
.onCancel { print("Canceled!") }
}
}Navigation SearchBar
Text("Hello, world!")
.navigationSearchBar {
SearchBar("Placeholder", text: $text)
}
.navigationSearchBarHiddenWhenScrolling(true)TextView
TextView("placeholder text", text: $text, onEditingChanged: { editing in
print(editing)
})VisualEffectBlurView
VisualEffectBlurView(blurStyle: .dark)
.edgesIgnoringSafeArea(.all)Status Bar Item
Text("Hello, world!")
.statusItem(id: "foo", image: .system(.exclamationmark)) {
Text("Popover!")
.padding()
}Edit Menu
Text("Hello, world!")
.editMenu(isVisible: $isEditMenuVisible) {
EditMenuItem("Copy") {
// Perform copy action
}
EditMenuItem("Paste") {
// Perform paste action
}
}Additional APIs
- Appearance: View/visible(_:) - Sets a view visibility
- Error Handling: TryButton - A button capable of performing throwing functions
- Geometry: flip3D(_:axis:reverse:), RectangleCorner, ZeroSizeView
- Keyboard: Keyboard object, View/padding(.keyboard)
- Navigation Bar: navigationBarColor, navigationBarTranslucent, navigationBarTransparent, navigationBarLargeTitle
- Scrolling: View/isScrollEnabled(_:) for CocoaList, CocoaScrollView, CollectionView, TextView
- Screen: Screen, UserInterfaceIdiom, UserInterfaceOrientation
- Scroll: ScrollIndicatorStyle, HiddenScrollViewIndicatorStyle
- Window: View/windowOverlay(isKeyAndVisible:content:)
Contributing
SwiftUIX welcomes contributions in the form of GitHub issues and pull-requests. Please refer the projects section before raising a bug or feature request.
bundle install
bundle exec fastlane generate_xcodeproj
bundle exec fastlane buildLicense & Credits
License: MIT License
SwiftUIX is led and maintained by @vatsal_manot. Special thanks to Brett Best, Nathan Tanner, Kabir Oberai, and 50+ contributors.
Stats: 8k+ stars, 72 watchers, 485 forks, 23 releases
Support: SwiftUIX is free and open-source. Consider contributing or donating via Patreon.