SnapKitten — Swift library for linear layout

let userProfile : UIView = 
Kitten.horizontal().from()
.add(imageView).size(40)
.add(label).itemOffset(10)
.build()
let userProfile : UIView = Kitten.horizontal().from().defaultAlignment(.start)
.add(iv).size(40)
.add(lblA).itemOffset(10)
.build()
userProfile.backgroundColor = UIColor.orangelet bottomMenu =
Kitten.horizontal().from()
.weightMode(true)
.add(ivA).height(60)
.add(ivB).height(60)
.add(ivC).height(60)
.build()
let scrollView = UIScrollView()Kitten.create(.vertical).from(viewController).isAlignDirectionEnd(true).add(userProfile).alignSideStart()
.add(scrollView).fillParent()
.add(bottomMenu)
.build()
pod "SnapKitten"
import UIKit
import SnapKitten
import PlaygroundSupport

let virtualView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 100))
virtualView.backgroundColor = UIColor.gray
PlaygroundPage.current.liveView = virtualView

let iv = UIImageView()
iv.backgroundColor = UIColor.red
let lblA = UILabel()
lblA.text = "Hello World"
lblA.backgroundColor = UIColor.blue

let simpleComponent = Kitten.horizontal().from()
.add(iv).size(40)
.add(lblA).itemOffset(10)
.build()
simpleComponent.backgroundColor = UIColor.green

Kitten.create(.vertical).from(virtualView)
.add(simpleComponent).align(.start)
.build()
//some java code example
Kitten.create(KittenOrientation.vertical) .from(mainView).isAlignDirectionEnd(true) .add(temp).align(KittenAlignment.parent) .add(imageView)
.add(textViewA).build();

Thank you for your reading!

--

--

--

Team lead of enterprise company, focus on mobile native and react native

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

AFEN DEVELOPMENT UPDATE (#3):

Considerazioni sullo staking OHM prima della migrazione

Building Lambda Layers by Cheating (a bit)

How to Claim your Aurora Reward from S

There is not a lot of information about the beginnings of Tinder, its fundraising-round history, or

Data Ingestion using Pandas

Online Stock Span

BlackBox Development Update

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
spring wong

spring wong

Team lead of enterprise company, focus on mobile native and react native

More from Medium

How To Implement A ZStack in UIKit using AutoLayout

A ZStack built with UIKit

Face ID & Touch ID — Customized cancel button title and fallback button title in Swift, iOS

Change app icon dynamically

Preventing Invalid Characters from Being Entered in a UITextField