Function across multiple view controllers

2019-08-03 12: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条回答
Emotional °昔
2楼-- · 2019-08-03 12:47

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.

查看更多
登录 后发表回答