/XYViewPlaceholder

A simple solution to set a placeholder or show UIView's size, Swift version of https://github.com/adad184/MMPlaceHolder

Primary LanguageSwiftOtherNOASSERTION

XYViewPlaceholder

A simple solution to set a placeholder or show UIView's size. It's a Swift version of MMPlaceHolder, which written in objc (Now MMPlaceHolder has its own official Swfit version XXPlaceHolder).

Please see the original MMPlaceHolder for more introduction.

XYViewPlaceholder implemented by using method swizzling (中文翻译见这里).

Screenshot


screenshots

Installation


Just drag XYViewPlaceholder.swift file to your Swfit project.

Usage


Simply write one line code.

yourView.showPlaceholder()

or customize yourself.

// show
showPlaceholderWith(lineColor: UIColor)
showPlaceholderWith(lineColor: UIColor, backColor: UIColor)
showPlaceholderWith(lineColor: UIColor, backColor: UIColor, arrowSize: CGFloat)
showPlaceholderWith(lineColor: UIColor, backColor: UIColor, arrowSize: CGFloat, lineWidth: CGFloat)
showPlaceholderWith(lineColor: UIColor, backColor: UIColor, arrowSize: CGFloat, lineWidth: CGFloat, frameWidth: CGFloat, frameColor: UIColor)

// show all sub views
yourView.showPlaceholderWithAllSubviews()    
yourView.showPlaceHolderWithAllSubviewsWith(maxPath: UInt)

// hide
yourView.hidePlaceholder()
yourView.hidePlaceholderWithAllSubviews()

// remove
yourView.removePlaceholder()    
yourView.removePlaceholderWithAllSubviews()

Issues


Fix hide and remove placeholders.(Thanks @adad184 for telling me this bug)

License


This code is distributed under the terms and conditions of the MIT license.