Giter Club home page Giter Club logo

wlkit's Introduction

WLKit

Simple utilities for getting things done.

SLE

Simple Layout Engine

A simplistic layout engine. Think what if CGRectDivide() went all the way.

Usage:

let layout = Layout(parentFrame: frame, direction: .column)
try layout.add(item: .flexible)
try layout.add(item: .height(200))

let topFrame = try layout.frame(at: 0)
let bottomFrame = try layout.frame(at: 1)

addSubview(SLECreateView(topFrame, .red))
addSubview(SLECreateView(bottomFrame, .blue))

Read More

VFL

Visual Formatting Language

Simple wrapper around Apple's ascii based constraints. But also stateful.

Usage:

VFL(self)
  .add(subview: MyView(), name: "view")
  .appendConstraints(formats: ["H:|[view(320)]|", "V:|[view(480)]|"])

But unlike other wrappers, VFL is meant to be used as a supplement and not a replacement. So you can also add constraints created using system API. Here's an example that creates a view of size 320x480 and aligns it to the center of parent

let view = VFLColorView()

VFL(self)
  .add(subview: view, name: "view")
  .appendConstraints(formats: [
    "H:[view(320)]", "V:[view(480)]",]
  )
  .appendConstraints([
    NSLayoutConstraint(
      item: view, attribute: .centerX,
      relatedBy: .equal,
      toItem: self, attribute: .centerX,
      multiplier: 1, constant: 0
    ),
    NSLayoutConstraint(
      item: view, attribute: .centerY,
      relatedBy: .equal,
      toItem: self, attribute: .centerY,
      multiplier: 1, constant: 0
    )
  ])

Read More

  1. Introducing VFL
  2. Autolayout and aligning subviews

FLIC

Feedback Loop is Cool

Best way to build GUI apps!

Usage

enum AsyncViewModel {
  case loading
  case success(UIView)
  case error(AppError)
}

class AsyncView: View<AsyncViewModel>, ContentViewBindable {
  var contentView: UIView { self }
  
  override func setUp() {
    super.setUp()
    backgroundColor = .white
  }
  
  override func viewModelDidUpdate() {
    super.viewModelDidUpdate()
    switch viewModel {
    case .loading:
      self.view = LoadingView(true)
    case .success(let view):
      self.view = view
    case .error(let error):
      self.view = ErrorView(error)      
    }
  }
}

Read More

wlkit's People

Contributors

chunkyguy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.