This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Define the size of the board | |
| let row = 8 | |
| let column = 8 | |
| // Define the number of mines | |
| let numberOfMines = 10 | |
| // Create an 2D array to represent the board | |
| var board = [[Int]](repeating: [Int](repeating: 0, count: 8), count: 8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol TextFieldValidatorStrategy { | |
| func validate(_ field: UITextField) -> Bool | |
| } | |
| struct TextFieldValidator { | |
| let strategy: TextFieldValidatorStrategy | |
| func validate(_ field: UITextField) -> Bool { | |
| if let _ = field.text { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import Foundation | |
| struct TextFieldValidator { | |
| enum FieldValidationType { | |
| case empty | |
| case sizeGreaterThenThree | |
| case onlyNumbers | |
| } | |