Skip to content

Instantly share code, notes, and snippets.

@fermoya
Created November 6, 2018 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fermoya/445115183c5a71cffe597064a20e665e to your computer and use it in GitHub Desktop.
Save fermoya/445115183c5a71cffe597064a20e665e to your computer and use it in GitHub Desktop.
Markdown
/**
Initializes a new Show Case View.
- Parameter target: The bar button that's targeted and whose feature is intended to be exaplained
- Parameter label: *Optional*, an identifier for the show case
- Remark: From iOS 11 onwards, the target must be a custom bar button item, that is, it must have been created by using *init(customView: UIView?)* constructor. If not so, it'll return *nil*
- Note: The show case arrow direction will always point upwards
*/
public init?(target: UIBarButtonItem, label: String? = nil) {
let targetViewUnwrapped = target.customView ?? (target.value(forKey: "view") as? UIView)
guard let targetView = targetViewUnwrapped else { return nil }
self.target = targetView
self.arrowDirection = .up
self.label = label
super.init(frame: CGRect.zero)
isBarButton = true
shouldWhitenScreenshot = true
setUp()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment