Skip to content


Informations presented on this page may be incomplete or outdated. You can find the most up-to-date version reading my book Learn Swift by examples. Beginner level

I hope that you know how to play battleship game. If not, please isit for example this web page: Battleship (game).

Few notes befor we start:

  • I pay great arttention to make all the contents intuitive and easy to follow.
  • I assume some basic general programming knowledge (what is a loop, what kinds of loops we have, what is a conditional statement).
  • I assume basic knowledge about object oriented programming paradigms (what is a class their methods and properties).
  • I assume at least basic progamming skills.
  • I will not discuss all the topic exhaustively, I will only deal with topics that are necessary to understand the content.
  • It's not intended to give a complete Swift/iSO/macOS programming overview.
  • I don't follow blindly object oriented programming rules and very often leave some properties visible to other classes. This concerns mainly frequently used variables for which using so called accessors (get-ers and set-ers) would be an overhead -- please remember that any function call consumes a time.
  • The code presented by me is to be first of all clear and understandable and, as a consequence, will not always be optimal.
  • If some part of text or code is not clear and you have problems with understand it, please let me know. I will try to rewrite it to make it more understandable. Remember: this book is written by me for you not just for my complacency.