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

Popular posts from this blog

javascript - Why Selenium can't find an element that is graphically visible -

java - How to compare two classes -

mysql - Gateway Timeout Error on Insert 70000 record using Hibernate in Java -