Enable Live Reload with InjectionForXcode
masterCmd+S), without needing to relaunch the app.repository·master·Indexed 25 days ago
https://github.com/freshos/steviaA Swift-based visual layout engine for iOS and tvOS providing a chainable, equation-based API alternative to Auto Layout. Features a DSL for defining view hierarchies, layout constraints, and styling blocks, with support for installation via Swift Package Manager.
Cmd+S), without needing to relaunch the app.Stevia is installed using the official Swift Package Manager (SPM).
File > Swift Packages > Add Package Dependency....https://github.com/freshOS/Stevia.Note: Other package managers like Carthage or CocoaPods are deprecated as of version 4.8.0.
For more precise control, use an equation-based syntax to define constraints between views or relative to container dimensions. You can also set layout priorities.
email.Top == 100
password.CenterY == forgot.CenterY
login.Top >= password.Bottom + 20
login.Width == 75 % Width
(image.Height == 100).priority = UILayoutPriority(rawValue: 999)Use the style method to group property assignments (like fonts, colors, or keyboard types) for a view into a single, readable block.
email.style { f in
f.borderStyle = .roundedRect
f.autocorrectionType = .no
f.keyboardType = .emailAddress
f.font = UIFont(name: "HelveticaNeue-Light", size: 26)
f.returnKeyType = .next
}Stevia provides a highly readable DSL for defining view hierarchies and layouts. You can define spacing, view dimensions, and relative positioning using a concise syntax that generates native NSLayoutConstraints.
layout {
100
|-email-| ~ 80
10%
|-password-forgot-| ~ 80
>=20
|login| ~ 80
0
}You can chain layout methods directly on views to set properties like position, size, and alignment.
email.top(100).left(8).right(8).width(200).height(44)
alignHorizontally(password, forgot)
image.fillContainer()
button.centerInContainer().size(50%)
equalWidths(email, password)
image.width(>=80)Instead of manually setting translatesAutoresizingMaskIntoConstraints = false and calling addSubview() for every view, use the subviews block to manage the hierarchy concisely.
subviews {
email
password
login
}