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

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -