Swiftpack.co - MLSDev/LoadableViews as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by MLSDev.
MLSDev/LoadableViews 3.6.1
Easiest way to load view classes into another XIB or storyboard.
⭐️ 42
🕓 2 years ago
.package(url: "https://github.com/MLSDev/LoadableViews.git", from: "3.6.1")

CI codecov.io Platform CocoaPods Compatible Swift Package Manager compatible Packagist


Easiest way to load view classes into another XIB or storyboard.


Basic setup

  • Subclass your view from LoadableView
  • Create a xib file, set File's Owner class to your class
  • Link outlets as usual


  • Drop UIView to your XIB or storyboard
  • Set it's class to your class name

Your view is automatically loaded to different xib!

IBInspectable && IBDesignable

IBInspectables automatically render themselves if your view is IBDesignable. Usually Interface Builder is not able to automatically figure out that your view is IBDesignable, so you need to add this attribute to your view subclass:

  @IBDesignable class WTFCatView: LoadableView

UI classes supported

  • ☑ UIView - LoadableView
  • ☑ UITableViewCell - LoadableTableViewCell
  • ☑ UICollectionViewCell - LoadableCollectionViewCell
  • ☑ UICollectionReusableView - LoadableCollectionReusableView
  • ☑ UITextField - LoadableTextField
  • ☑ NSView - LoadableView using AppKit

To use loading from xibs, for example for UICollectionViewCells, drop UIView instead of UICollectionViewCell in InterfaceBuilder, and follow basic setup. Then, on your storyboard, set a class of your cell, and it will be automatically updated.


Change xib name

class CustomView : LoadableView {
  override var nibName : String {
    return "MyCustomXibName"

Change view container

  class CustomViewWithLoadableContainerView : LoadableView {
    override var nibContainerView : UIView {
      return containerView

Making your custom views loadable

  • Adopt NibLoadableProtocol on your custom UIView or NSView subclass.
  • Override nibName and nibContainerView properties, if necessary.
  • Call setupNib method in both init(frame:) and init(coder:) methods.

Known issues

  • IBDesignable attribute is not recognized when it's inside framework due to bundle paths, which is why in current version you need to add IBDesignable attribute to your views manually.
  • UITableViewCell and therefore LoadableTableViewCell cannot be made IBDesignable, because InterfaceBuilder uses initWithFrame(_:) method to render views: radar, stack overflow
  • UIScrollView subclasses such as UITextView don't behave well with loadable views being inserted, which is why UITextView loadable subclass is not included in current release, but may be implemented in the future.


  • iOS 8+
  • tvOS 9.0+
  • macOS 10.12+
  • Swift 5 / 4.0 / 3.2



  pod 'LoadableViews'


LoadableViews is released under the MIT license. See LICENSE for details.

About MLSDev


LoadableViews are maintained by MLSDev, Inc. We specialize in providing all-in-one solution in mobile and web development. Our team follows Lean principles and works according to agile methodologies to deliver the best results reducing the budget for development and its timeline.

Find out more here and don't hesitate to contact us!


Stars: 42
Last commit: 9 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

2 years ago


  • Build issues for MacCatalyst following previous AppKit support.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics