llinardos / XibView

A Xib based UIView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XibView

A .xib based UIView, named XibView.

  • A utility base class to develop custom views based on xib files. It allows you to use a xib based view inside another xib based view, promoting reusable, isolated and composable views.
  • An XCode template to facilitate creation of .xib based views are also added in both languages, swift and obj-c.
  • An XCode template to facilitate creation of .xib based cells.

Instalation

  1. Import XibView.h and XibView.m if you're coding on objc or XibView.swift if you're coding on Swift.
  2. Create a new view class which inherits from XibView (e.g.: CustomView).
  3. Create a new .xib file with the same name your class (e.g.: CustomView.xib).
  4. Set your class as first responder of your nib.

Tip Steps 2 to 4 can be automated using Xcode templates.

Developing a .xib based custom view

Just add UI components to the view in the xib file, configure (colors, fonts, etc.), connect IBOutlets and IBActions, etc.

In another view .xib or view controller .xib or .storyboard, add a UIView and change its type to the new view.

Automation using XCode templates

XibView

If you want to add the template, just download this repo, move to ./xcode-template and run ./add-xcode-templates.sh.

If you do so, you will see a XibView template when you create a new file to your project.

img1

If you pick it, you must enter the new view class name and if it's objc or swift.

img2

Done, you will find your files on the project navigator.

For objc:

img3

For swift:

img4

XibCell

A XibCell template is also added. It creates a cell saving the time used to set UITableViewCell as subclass, removing the automated TableViewCell suffix and checking the Also create Xib file checkbox. So, you click on XibCell, enters the name of your cell (e.g.: ItemCell) and ItemCell.swift (or ItemCell.h and ItemCell.m) and ItemCell.xib are created.

About

A Xib based UIView.

License:GNU General Public License v3.0


Languages

Language:Objective-C 45.5%Language:Swift 31.8%Language:Shell 22.7%