AEXibceptionView

This class is used for building nested XIB files (Xibception)

For example, imagine that we have next files:

  • FirstView.swift, FirstView.xib
  • SecondView.swift, SecondView.xib
  • CustomCell.swift, CustomCell.xib

Our goal is to add FirstView and SecondView to CustomCell.xib, but to load these views from their XIB files instead from code.

These are the steps:

  • FirstView and SecondView must inherit from AEXibceptionView
  • In their XIB files File’s Owner must be set to their class (FirstView, SecondView)
  • In their XIB files root view should be connected to File’s Owner contentView property
  • In cell’s XIB file File’s Owner and Cell itself must be set to CustomCell class
  • Add views to CustomCell.xib and set their class to FirstView and SecondView
  • View outlet that should be connected from the File’s owner in storyboard.

    Declaration

    Swift

    @IBOutlet public lazy var contentView: UIView! =
  • AEXibceptionView will add representation of self from XIB as the contentView property.

    Returns an object initialized from data in a given unarchiver. (required)

    Declaration

    Swift

    required public init(coder aDecoder: NSCoder)

    Parameters

    aDecoder

    An unarchiver object.