The wording of the proxy agreement in Swift.
This is the first page with a button and a label, button click to jump to the next page.
The second page has an input box and a button, click the button to set the contents of the input box to the content of the first page label. The effect is as follows
Next is the Code section. The same thing as OC. The code for the UI of the first page is no longer written here. Look directly at the code for the second page.
import uikitprotocol secondviewcontrollerdelegate{ // Create agreement }class Secondviewcontroller:uiviewcontroller { delegate// Set proxy properties var Testtf:uitextfield!
Creating a protocol and declaring proxy properties
Func DoClick () {//Button Association method implementation delegate?. Changelabeltext (TextStr:testTF.text)// allow Proxy to execute proxy method }
The method implementation of the Button association.
Func DoClick () {// Click to jump to next page let SECONDVC = Secondviewcontroller ()// Create an instance of the second page SECONDVC. Delegate = self// set proxy true) } func Changelabeltext (#textStr: String) {// Implement proxy method println (" Go proxy method ") = textstr }
This is the code part of the first page and requires him to accept the agreement.
Conclusion
I started working on the SDK for the past few days. Use of some knowledge is not covered before, such as 8583 package, UnionPay norms, anyway, much, It is still too little to learn to use something new. So the time to learn Swift is limited. There is only a little time to learn. Here are just some simple exercises ...
Swift learns _08 from scratch (proxy protocol pass value)