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 -

mongodb - Multiple $and with multiple $or in $match mongoose -

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