カジュアルにはじめるVFL / Let's start VFL

9bda8755a689204677a198ee85c0eb07?s=47 banjun
March 28, 2018

カジュアルにはじめるVFL / Let's start VFL

AKIBA.swift × エウレカ コードレイアウト勉強会
2018-03-28
https://classmethod.connpass.com/event/81032/

9bda8755a689204677a198ee85c0eb07?s=128

banjun

March 28, 2018
Tweet

Transcript

  1. 6.

    Α͘ݟ͔͚Δ7'- Will attempt to recover by breaking constraint <NSLayoutConstraint:0x60400009f630 H:[UIImageView:

    0x7fa08ef0b820]-(8)-[UILabel:0x7fa08ef0bba0'Name'] (active)> ੍໿͕ίϯϑϦΫτͨ͠ͱ͖ͷίϯιʔϧϩά ςΩετίϛϡχέʔγϣϯ
  2. 13.

    override func loadView() { super.loadView() let autolayout = northLayoutFormat(["p": 8],

    [ "icon": iconView, "name": nameLabel]) autolayout("H:|-p-[icon(==64)]") autolayout("H:|-p-[name]-p—|") autolayout("V:|-p—[icon(==64)]-p-[name]") } iconView nameLabel
  3. 26.

    7'-ύʔαʔΛͭ͘Δ struct VFL { let orientation: Orientation let firstBound: (Bound,

    Connection)? let firstView: View let views: [(Connection, View)] var lastView: View {return views.last?.1 ?? firstView} let lastBound: (Connection, Bound)?
  4. 27.

    7'-ύʔαʔΛͭ͘Δ enum Orientation {case h, v} struct View { let

    name: String let predicateListWithParens: [Predicate] } enum Bound: String { case superview = "|" case layoutMargin = "||" } struct Connection { let predicateList: PredicateList }
  5. 28.

    7'-ύʔαʔΛͭ͘Δ enum PredicateList { case simplePredicate(SimplePredicate) case predicateListWithParens([Predicate]) } enum

    SimplePredicate { case metricName(MetricName) case positiveNumber(CGFloat) } enum Relation {case eq, le, ge} enum ObjectOfPredicate { case constant(Constant) case viewName(ViewName) }
  6. 29.

    7'-ύʔαʔΛͭ͘Δ enum Constant { case metricName(MetricName) case number(CGFloat) } enum

    Priority { case metricName(MetricName) case number(CGFloat) } struct Predicate { let relation: Relation? let objectOfPredicate: ObjectOfPredicate let priority: Priority? } }