Function across multiple view controllers

随声附和 提交于 2020-02-05 04:28:42

问题


I am trying to make a function so that I request a 'manager override' where it presents a screen for a manager to enter their password and press an approve button. How should I do this? Will it have to be in multiple functions? Is there a way that I can call one function and it present the information back? Would a completion work for what I need? I have no ideas where to start for this.

My set up is as follows:

A view controller asks for manager approval, then a screen slides up with text boxes and an approve button. I want the approve button to trigger authenticating and dismissing the screen


回答1:


Assuming you don't want a Framework target (that sounds like overkill for what you want) simply mark the function as "public" and move it outside of any class. I just tried in a sample project and it works.

It looks important - remember to keep it in a file already in the project. (My sample project didn't work with menu option File|Add|New|File.)

Now, if you really want portability, check out how to create a Framework project.



来源:https://stackoverflow.com/questions/40869865/function-across-multiple-view-controllers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!