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.
-
Charts
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart. -
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 -
folding-cell
:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion -
NVActivityIndicatorView
A collection of awesome loading animations -
LTMorphingLabel
[EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift. -
SwiftMessages
A very flexible message bar for iOS written in Swift. -
JTAppleCalendar
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable -
FSPagerView
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders. -
Pagemenu
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram) -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
AMScrollingNavbar
Scrollable UINavigationBar that follows the scrolling of a UIScrollView -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
TextFieldEffects
Custom UITextFields effects inspired by Codrops, built using Swift -
Macaw
Powerful and easy-to-use vector graphics Swift library with SVG support -
SPPermission
Universal API for request permission and get its statuses. -
Alerts Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
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. -
PermissionScope
A Periscope-inspired way to ask for iOS permissions. -
Material Components for iOS
[In maintenance mode] Modular and customizable Material Design UI components for iOS -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
ESTabBarController
:octocat: ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie! -
Instructions
Create walkthroughs and guided tours (coach marks) in a simple way, with Swift. -
ActiveLabel
UILabel drop-in replacement supporting Hashtags (#), Mentions (@) and URLs (http://) written in Swift -
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! -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
PKHUD
A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8. -
Siren
Notify users when a new version of your app is available and prompt them to upgrade. -
Persei
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift -
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. -
DGElasticPullToRefresh
Elastic pull to refresh for iOS developed in Swift -
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 -
XLActionController
Fully customizable and extensible action sheet controller written in Swift -
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
Appwrite - The open-source backend cloud platform
* 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.