SwiftyBootstrap is a Framework designed to help you build UI's programmatically more quickly. It's designed after Twitter Bootstrap, mainly the use of columns to specify how a UI element will be laid out across various device sizes.
Now you can quickly specify how you want your layout to show on different devices in only a few lines of code.
To run the example project, clone the repo, and run pod install from the Example directory first.
To see the full documentation click here.
iOS 12.0+ Xcode 10.0+ Swift 4.0+
SwiftyBootstrap is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SwiftyBootstrap'- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Below is a simple example of adding two buttons to the screen.
let card = GRBootstrapElement()
card.addRow(columns: [
Column(UIButton().withAttributes(closure: { view in
let button = view as? UIButton
button?.setTitle("Button 1", for: .normal)
})
.cardSet(),
xsColSpan: .Twelve) // Full screen on xtra small screen (iPhone Portrait, split screen smaller section)
.forSize(.sm, .Six) // Half screen on small screen (iPhone Landscape, split screen half of screen)
.forSize(.md, .Three), // Quarter of the screen on iPad portrait
Column(UIButton().withAttributes(closure: { view in
let button = view as? UIButton
button?.setTitle("Button 2", for: .normal)
})
.cardSet(),
xsColSpan: .Twelve), // Full screen on xtra small and since no other size classes are specified, full screen on all sizes
], anchorToBottom: true)
card.addToSuperview(superview: self.view)In this example we used size classes like above to specify how the layout would change as the size of the device changes.
RPReplay_Final1669043902.MP4
adeiji, adeiji@yahoo.com
SwiftyBootstrap is available under the MIT license. See the LICENSE file for more info.