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

打印 被阅读次数

[阅读全文]

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.

...

[阅读全文]

登录后才可评论.