Few.swift alternatives and similar libraries
Based on the "UI" category.
Alternatively, view Few.swift alternatives based on common mentions on social networks and blogs.
-
Animated Tab Bar
:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion -
FSPagerView
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders. -
JTAppleCalendar
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable -
Pagemenu
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram) -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
Material Components for iOS
[In maintenance mode] Modular and customizable Material Design UI components for iOS -
Alerts Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
ESTabBarController
:octocat: ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie! -
SideMenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less. -
Scrollable-GraphView
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift. -
ActiveLabel
UILabel drop-in replacement supporting Hashtags (#), Mentions (@) and URLs (http://) written in Swift -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
SlideMenuControllerSwift
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift. -
TLYShyNavBar
Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars! -
Whisper
:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside -
KMNavigationBarTransition
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically. -
StarWars.iOS
This component implements transition animation to crumble view-controller into tiny pieces. -
CircleMenu
:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion -
RazzleDazzle
A simple keyframe-based animation framework for iOS, written in Swift. Perfect for scrolling app intros. -
PaperOnboarding
:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion
WorkOS - The modern identity platform for B2B SaaS
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Few.swift or a related project?
README
Few.swift
React-inspired library for writing AppKit/UIKit UIs which are functions of their state.1
SwiftBox is used for layout.
Why
UIs are big, messy, mutable, stateful bags of sadness.
Few.swift lets us express UIs as stateless, composable, immutable-ish values of their state. When their state changes, Few.swift calls a function to render the UI for that state, and then intelligently applies any changes.
To put it another way, the state is the necessary complexity of the app. The view is a mapping from state to its representation.
Example
Here's a simple example which counts the number of times a button is clicked:
// This function is called every time `component.updateState` is called.
func renderApp(component: Component<Int>, count: Int) -> Element {
return View()
// The view itself should be centered.
.justification(.Center)
// The children should be centered in the view.
.childAlignment(.Center)
// Layout children in a column.
.direction(.Column)
.children([
Label("You've clicked \(count) times!"),
Button(title: "Click me!", action: {
component.updateState { $0 + 1 }
})
.margin(Edges(uniform: 10))
.width(100),
])
}
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
private let appComponent = Component(initialState: 0, render: renderApp)
func applicationDidFinishLaunching(notification: NSNotification) {
let contentView = window.contentView as NSView
appComponent.addToView(contentView)
}
}
Or a slightly more involved example, a temperature converter:
struct ConverterState {
static let defaultFahrenheit: CGFloat = 32
let fahrenheit = defaultFahrenheit
let celcius = f2c(defaultFahrenheit)
}
private func c2f(c: CGFloat) -> CGFloat {
return (c * 9/5) + 32
}
private func f2c(f: CGFloat) -> CGFloat {
return (f - 32) * 5/9
}
private func renderLabeledInput(label: String, value: String, autofocus: Bool, fn: String -> ()) -> Element {
return View()
// Layout children in a row.
.direction(.Row)
.padding(Edges(bottom: 4))
.children([
Label(label).width(75),
Input(
text: value,
placeholder: label,
action: fn)
// Autofocus means that the Input will become the first responder when
// it is first added to the window.
.autofocus(autofocus)
.width(100),
])
}
private func render(component: Component<ConverterState>, state: ConverterState) -> Element {
let numberFormatter = NSNumberFormatter()
let parseNumber: String -> CGFloat? = { str in
return (numberFormatter.numberFromString(str)?.doubleValue).map { CGFloat($0) }
}
return View()
// Center the view.
.justification(.Center)
// Center the children.
.childAlignment(.Center)
.direction(.Column)
.children([
// Each time the text fields change, we re-render. But note that Few.swift
// is smart enough not to interrupt the user's editing or selection.
renderLabeledInput("Fahrenheit", "\(state.fahrenheit)", true) {
if let f = parseNumber($0) {
component.updateState { _ in ConverterState(fahrenheit: f, celcius: f2c(f)) }
}
},
renderLabeledInput("Celcius", "\(state.celcius)", false) {
if let c = parseNumber($0) {
component.updateState { _ in ConverterState(fahrenheit: c2f(c), celcius: c) }
}
},
])
}
This is super cool because the only thing that's mutating is the state. Few.swift is in charge of making an in-place changes to the UI when the state changes.
See [FewDemo](FewDemo) for some more involved examples.
How does this compare to React Native/ComponentKit?
A few of the most notable differences:
- Few.swift is written in... Swift. Type safety is cool.
- Single-threaded. React Native and ComponentKit both do layout on a non-main thread. Few.swift keeps everything on the main thread currently.
- Both React Native and ComponentKit are battle-tested. They've been used in shipping apps. Few.swift has not.
- React Native has an awesome live reload feature.
Quirks
Swift's pretty buggy with concrete subclasses of generic superclasses: https://gist.github.com/joshaber/0978209efef7774393e0. This hurts.
Should I use this?
Probably :doughnut:. See above about how it's not battle-tested yet. Pull requests welcome :sparkling_heart:.
--
1. React, but for Cocoa. A reactive Cocoa, one might say.