mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-04-23 09:08:40 +02:00
Essential changes for Xcode 11 beta4
This commit is contained in:
@@ -38,14 +38,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
gameLogic.newGame()
|
||||
}
|
||||
|
||||
override func buildCommands(with builder: UICommandBuilder) {
|
||||
override func buildMenu(with builder: UIMenuBuilder) {
|
||||
builder.remove(menu: .edit)
|
||||
builder.remove(menu: .format)
|
||||
builder.remove(menu: .view)
|
||||
|
||||
builder.replaceChildren(ofMenu: .file) { oldChildren in
|
||||
var newChildren = oldChildren
|
||||
let newGameItem = UIMutableKeyCommand(input: "N",
|
||||
let newGameItem = UIKeyCommand(input: "N",
|
||||
modifierFlags: .command,
|
||||
action: #selector(newGame(_:)))
|
||||
newGameItem.title = "New Game"
|
||||
|
||||
@@ -21,7 +21,7 @@ final class GameLogic : BindableObject {
|
||||
|
||||
typealias BlockMatrixType = BlockMatrix<IdentifiedBlock>
|
||||
|
||||
let didChange = PassthroughSubject<GameLogic, Never>()
|
||||
let willChange = PassthroughSubject<GameLogic, Never>()
|
||||
|
||||
fileprivate var _blockMatrix: BlockMatrixType!
|
||||
var blockMatrix: BlockMatrixType {
|
||||
@@ -42,12 +42,12 @@ final class GameLogic : BindableObject {
|
||||
_blockMatrix = BlockMatrixType()
|
||||
generateNewBlocks()
|
||||
|
||||
didChange.send(self)
|
||||
willChange.send(self)
|
||||
}
|
||||
|
||||
func move(_ direction: Direction) {
|
||||
defer {
|
||||
didChange.send(self)
|
||||
willChange.send(self)
|
||||
}
|
||||
|
||||
var moved = false
|
||||
@@ -136,7 +136,7 @@ final class GameLogic : BindableObject {
|
||||
|
||||
// Don't forget to sync data.
|
||||
defer {
|
||||
didChange.send(self)
|
||||
willChange.send(self)
|
||||
}
|
||||
|
||||
// Place the first block.
|
||||
|
||||
Reference in New Issue
Block a user