ChessKit
A chess board view.
This project is meant to be used for production apps.
Features
- Move pieces (dragging + click)
- Load PGN / Extract PGN
- Navigate through PGN
How to use
Create a ChessBoardView
Add a chess board view programmatically to your view hierarchy
let boardView = ChessBoardView()
view.addSubview(boardView)
Load PGN
Load a PGN onto your chess board
let pgn = "1. e4 e5 2. Nf3 Nc6"
boardView.loadPgn(pgn)
Navigates through PGN
Load or unload moves from the PGN on the chess board
boardView.loadNextMove()
boardView.unloadPreviousMove()
boardView.loadAllMoves()
boardView.unloadAllMoves()
Print the PGN
Print the PGN of the chess board using the following code
print(boardView.pgn)
// 1. e4 e5 2. Nf3 Nc6
To Do
- Animate PGN
- Animate invalid move because of king in check
- Play sounds (move, capture, castle, check, checkmate, invalid move)