Latest 0.1.0
Homepage https://github.com/marty-suzuki/LayoutGuaranteedView
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform
Carthage compatible

LayoutGuaranteedView is a Phantom Type view holder. It guaranteed that a view had laid out after execute guaranteeLayout function.

Example

class ViewController: UIViewController {
    let viewHolder = ViewHolder<UITableView>(frame: .zero, style: .plain)

    override func viewDidLoad() {
        super.viewDidLoad()

        let guaranteedViewHolder = viewHolder.guaranteeLayout(addingTo: view,
                                                   layoutHandler: { tableView -> [NSLayoutConstraint] in
            return [
                tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
                tableView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor),
                tableView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor),
                tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor)
            ]
        })

        // guaranteedViewHolder.view returns `UITableView` instance
        guaranteedViewHolder.view.delegate = self
        guaranteedViewHolder.view.dataSource = self
    }
}

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Xcode 9 or greater
  • iOS 9 or greater
  • Swift 4

Installation

CocoaPods

LayoutGuaranteedView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'LayoutGuaranteedView'

Carthage

If you’re using Carthage, simply add
SABlurImageView to your Cartfile:

github "marty-suzuki/LayoutGuaranteedView"

Make sure to add LayoutGuaranteedView.framework to "Linked Frameworks and Libraries" and "copy-frameworks" Build Phases.

Implementation

ViewHolder is a typealias of LayoutGuaranteedView_<LayouNotApplied, T>.
After executing guaranteeLayout function, LayoutGuaranteedView_<LayouNotApplied, T> returns a LayoutGuaranteedView_<LayoutApplied, T> instance.

Author

marty-suzuki, [email protected]

License

LayoutGuaranteedView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "LayoutGuaranteedView",
    "version": "0.1.0",
    "summary": "LayoutGuaranteedView is a Phantom Type view holder.",
    "homepage": "https://github.com/marty-suzuki/LayoutGuaranteedView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "marty-suzuki": "[email protected]"
    },
    "source": {
        "git": "https://github.com/marty-suzuki/LayoutGuaranteedView.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/marty_suzuki",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "LayoutGuaranteedView/*.{swift}",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This