Vingle Texture Style Guide

We hope anybody who loves iOS and Texture find this guide helpful!

1. Making UI Components

  • use lazy property for Conditional UI Component.

otherwise, you end up doing unnecessary allocation and computation even when given UI Component is not used at all

  • Don’t use node generate function!

We recommend to use automaticallyManagesSubnodes instead of addSubnode.

  • Place all UI Component attributes in Const structure.

2. LayoutSpec

  • // MARK: and // MARK: - is Swift equivalent of #pragma mark and #pragma mark - in Objective-C.

  • Recommended use extension for layoutSpec code cohesion & readability.
  • Do not put all the codes at layoutSpecThatFits: for readability sake
  • Meaningful layoutSpec separation. (Article)
  • Method name must ends with“LayoutSpec”.
  • Local layoutSpec variable name must ends with “Layout”.

override func layoutSpecThatFits(:) -> ASLayoutSpec {

let ~~~~layout = ~~~~layoutSpec(:)

}

  • FlexBox attribute should be defined at layoutSpecThatFits:
  • Recommended to create a flex-style sugar code as shown in the screenshot below.

4. Reactive Programming (* RxSwift)

RxSwiftCommunity/RxCocoa-Texture
_RxCocoa Extension Library for Texture. Contribute to RxSwiftCommunity/RxCocoa-Texture development by creating an…_github.com

RxCocoa doesn’t support Texture, So if you wanna use Rx, than download RxCocoa-Texture!. Currently, it maintained by Vingle Inc.

Please read README.md

  • Binding Logic has to be separate by using extension for code cohesion & readability.

  • Do not access directly target node from outside.
  • It is recommended to create reactive extension.

Complex Example

Vingle iOS팀은 수많은 사람들이 매일 새로운 관심사와 커뮤니티를 발견하는 빙글앱을 만들어 나갑니다.

[채용 공고] Vingle에서 함께 성장할 동료를 찾고 있습니다
_관심사로 세상을 잇다! 관심사 기반 SNS, Vingle_careers.vingle.net