customize ui with protocols
TRANSCRIPT
![Page 1: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/1.jpg)
Customize UI with Protocols
Pofat Tseng @Diuit
![Page 2: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/2.jpg)
Protocol
• Mixin(Traits)
• Type Class
• ovrride
•
![Page 3: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/3.jpg)
Customizing UI’s like…
![Page 4: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/4.jpg)
CSS UI
![Page 5: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/5.jpg)
![Page 6: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/6.jpg)
Voila!
![Page 7: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/7.jpg)
• UI
• UI
• UI
• extend UIKit protocol
![Page 8: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/8.jpg)
Protocol MVC
• Model -> cache
• Controller->
• View -> Style
![Page 9: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/9.jpg)
Remote Resource
![Page 10: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/10.jpg)
For images
![Page 11: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/11.jpg)
For JSON
![Page 12: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/12.jpg)
Easier avatar
• class
![Page 13: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/13.jpg)
• storyboard placeholder image)
• set mediaURL
![Page 14: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/14.jpg)
Weather Widget
•
![Page 15: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/15.jpg)
•
• (
![Page 16: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/16.jpg)
•
![Page 17: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/17.jpg)
![Page 18: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/18.jpg)
1
2
3
3
![Page 19: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/19.jpg)
![Page 20: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/20.jpg)
Diuit Messaging API
![Page 21: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/21.jpg)
![Page 22: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/22.jpg)
FATAL ERROR!?
![Page 23: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/23.jpg)
FATAL ERROR!?
ObjC!?
![Page 24: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/24.jpg)
Why• [ProtocolType] [ClassType]
runtime error
• Class @objc Array ObjC
• protocol AnyObject-compatible
• NSArray bridge
![Page 25: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/25.jpg)
Solution
1. map
2. protocol @objc compileruntime
3. Swift runtime library collection
![Page 26: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/26.jpg)
Pofat Tseng
Protocol
![Page 27: Customize UI with Protocols](https://reader031.vdocuments.us/reader031/viewer/2022022419/5883f1cb1a28ab34428b65a7/html5/thumbnails/27.jpg)
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
•