customize ui with protocols

27
Customize UI with Protocols Pofat Tseng @Diuit

Upload: pofat-tseng

Post on 23-Jan-2018

313 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Customize UI with Protocols

Customize UI with Protocols

Pofat Tseng @Diuit

Page 2: Customize UI with Protocols

Protocol

• Mixin(Traits)

• Type Class

• ovrride

Page 3: Customize UI with Protocols

Customizing UI’s like…

Page 4: Customize UI with Protocols

CSS UI

Page 5: Customize UI with Protocols
Page 6: Customize UI with Protocols

Voila!

Page 7: Customize UI with Protocols

• UI

• UI

• UI

• extend UIKit protocol

Page 8: Customize UI with Protocols

Protocol MVC

• Model -> cache

• Controller->

• View -> Style

Page 9: Customize UI with Protocols

Remote Resource

Page 10: Customize UI with Protocols

For images

Page 11: Customize UI with Protocols

For JSON

Page 12: Customize UI with Protocols

Easier avatar

• class

Page 13: Customize UI with Protocols

• storyboard placeholder image)

• set mediaURL

Page 14: Customize UI with Protocols

Weather Widget

Page 15: Customize UI with Protocols

• (

Page 16: Customize UI with Protocols

Page 17: Customize UI with Protocols
Page 18: Customize UI with Protocols

1

2

3

3

Page 19: Customize UI with Protocols
Page 20: Customize UI with Protocols

Diuit Messaging API

Page 21: Customize UI with Protocols
Page 22: Customize UI with Protocols

FATAL ERROR!?

Page 23: Customize UI with Protocols

FATAL ERROR!?

ObjC!?

Page 24: Customize UI with Protocols

Why• [ProtocolType] [ClassType]

runtime error

• Class @objc Array ObjC

• protocol AnyObject-compatible

• NSArray bridge

Page 25: Customize UI with Protocols

Solution

1. map

2. protocol @objc compileruntime

3. Swift runtime library collection

Page 26: Customize UI with Protocols

Pofat Tseng

Protocol

Page 27: Customize UI with Protocols

Reference• https://github.com/pofat/demoProtocolUI ( )

• https://github.com/VojtaStavik/ProtocolUI

• https://www.captechconsulting.com/blogs/ios-9-tutorial-series-protocol-oriented-programming-with-uikit

• Diuit API

• http://api.diuit.com/

• https://github.com/Diuit/DUMessagingUIKit-iOS

• Pofat Tseng