{"id":14640,"date":"2016-05-26T13:33:30","date_gmt":"2016-05-26T17:33:30","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=14640"},"modified":"2016-05-26T13:34:00","modified_gmt":"2016-05-26T17:34:00","slug":"building-on-auto-layout","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/05\/26\/building-on-auto-layout\/","title":{"rendered":"Building on Auto Layout"},"content":{"rendered":"<p><a href=\"http:\/\/bridgermaxwell.com\/blog\/building-on-auto-layout\/\">Bridger Maxwell<\/a>:<\/p>\n<blockquote cite=\"http:\/\/bridgermaxwell.com\/blog\/building-on-auto-layout\/\"><p>It is common to use <code>addConstraint<\/code> directly, but Auto Layout is actually a great engine to build layout systems on top of. In this post I&rsquo;ll talk about different abstraction layers on Auto Layout and show its advantages with my library <a href=\"https:\/\/github.com\/bridger\/StackLayout\">StackLayout<\/a>.<\/p><p>[&#8230;]<\/p><p>The simplest way we can build on Auto Layout is a thin syntactic layer for creating constraints that we still manage manually. Until iOS 9, the built-in way to create a constraint was quite verbose.<\/p><p>[&#8230;]<\/p><p>Higher up the abstraction scale is the Visual Format Language. When I interned at Apple on the Cocoa Frameworks team I helped with the initial implementation of Auto Layout and especially on the parser for the VFL. This lets you specify a few common layouts that can be written as ascii art.<\/p><p>I&rsquo;ve experimented by <a href=\"https:\/\/github.com\/bridger\/SwiftVisualFormat\">reimplementing some of it in Swift<\/a> using operator overloading. The idea is the same, but has the advantage of compile-time checking.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Bridger Maxwell: It is common to use addConstraint directly, but Auto Layout is actually a great engine to build layout systems on top of. In this post I&rsquo;ll talk about different abstraction layers on Auto Layout and show its advantages with my library StackLayout.[&#8230;]The simplest way we can build on Auto Layout is a thin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[200,69,31,30,74,71,901],"class_list":["post-14640","post","type-post","status-publish","format-standard","hentry","category-technology","tag-autolayout","tag-cocoa","tag-ios","tag-mac","tag-opensource","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/14640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=14640"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/14640\/revisions"}],"predecessor-version":[{"id":14643,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/14640\/revisions\/14643"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=14640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=14640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=14640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}