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.