Golden Thumb

remote tutor & close friend of chosen kids
proud dad of an awesome daughter

分五个步骤创建一个能用的国际象棋 App 5/5(走棋子)

(2019-10-11 13:07:27) 下一个


Five Steps to Create a Chess App 5/5

Donald Sheng
Oct 11 · 6 min read

To let different parts of our software talk with each other in professional way, we’ll create something called “protocol” in Swift programming language, which is similar to “interface” in Java programming language. Right click “Chess” folder on the left navigation panel and select “New File…” to create a new swift file. Make sure to choose “Swift File” under “iOS”. Click “Next” button to continue.

create a new swift file for our protocol

Give this protocol a name “ChessDelegate”. Click “Create” button to continue.

ChessDelegate is the protocol name

Key word “protocol” is another data type in Swift programming language. We used “class” and “struct” before. Type in the following 3 lines of code shawn in line 11, 12 and 13.



[ 打印 ]
阅读 ()评论 (0)