codepath / ios_guides

Comprehensive open-source iOS guides

Home Page:http://guides.codepath.com/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Views Quickstart add view programmatically

githubhero opened this issue · comments

Not a real issue, but you can avoid this line:

var imageView: CaptionableImageView!

because you can instantiate the view on the fly, even multiple times (eg. in a loop), by declaring it locally. There's no need to make it a class member.

(https://guides.codepath.com/ios/Custom-Views-Quickstart)