ios - How to call to an extension from another viewcontroller in swift? -
i have extension in 1 view controller.
extension uiviewcontroller { func hidekeyboardwhentappedaround() { let tap: uitapgesturerecognizer = uitapgesturerecognizer(target: self, action: #selector(uiviewcontroller.dismisskeyboard)) view.addgesturerecognizer(tap) } func dismisskeyboard() { view.endediting(true) } }
can call extention within viewcontroller
. if how can it? please me. thanks
it's simple. in other view controller write
self.hidekeyboardwhentappedaround() self.dismisskeyboard()
any extension have defined instantly available instance of class have extended.
Comments
Post a Comment