mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-04-27 11:07:11 +02:00
Xcode 11 beta 6
This commit is contained in:
@@ -10,7 +10,7 @@ import Foundation
|
||||
import SwiftUI
|
||||
import Combine
|
||||
|
||||
final class GameLogic : BindableObject {
|
||||
final class GameLogic : ObservableObject {
|
||||
|
||||
enum Direction {
|
||||
case left
|
||||
@@ -21,7 +21,7 @@ final class GameLogic : BindableObject {
|
||||
|
||||
typealias BlockMatrixType = BlockMatrix<IdentifiedBlock>
|
||||
|
||||
let willChange = PassthroughSubject<GameLogic, Never>()
|
||||
let objectWillChange = PassthroughSubject<GameLogic, Never>()
|
||||
|
||||
fileprivate var _blockMatrix: BlockMatrixType!
|
||||
var blockMatrix: BlockMatrixType {
|
||||
@@ -42,12 +42,12 @@ final class GameLogic : BindableObject {
|
||||
_blockMatrix = BlockMatrixType()
|
||||
generateNewBlocks()
|
||||
|
||||
willChange.send(self)
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
|
||||
func move(_ direction: Direction) {
|
||||
defer {
|
||||
willChange.send(self)
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
|
||||
var moved = false
|
||||
@@ -136,7 +136,7 @@ final class GameLogic : BindableObject {
|
||||
|
||||
// Don't forget to sync data.
|
||||
defer {
|
||||
willChange.send(self)
|
||||
objectWillChange.send(self)
|
||||
}
|
||||
|
||||
// Place the first block.
|
||||
|
||||
@@ -77,7 +77,7 @@ struct BlockGridView : View {
|
||||
y: CGFloat(block.index.1) * (65 + 12) + 32.5 + 12)
|
||||
.zIndex(self.zIndex(block.item))
|
||||
.transition(.blockAppear(from: self.blockEnterEdge))
|
||||
.animation(block.item == nil ? nil : .spring(mass: 1, stiffness: 400, damping: 56, initialVelocity: 0))
|
||||
// .animation(block.item == nil ? nil : .spring(mass: 1, stiffness: 400, damping: 56, initialVelocity: 0))
|
||||
}
|
||||
}
|
||||
.frame(width: 320, height: 320, alignment: .center)
|
||||
|
||||
Reference in New Issue
Block a user