diff --git a/ios/MagicCounter.xcodeproj/project.pbxproj b/ios/MagicCounter.xcodeproj/project.pbxproj index 4bcd6a5..4baf49a 100644 --- a/ios/MagicCounter.xcodeproj/project.pbxproj +++ b/ios/MagicCounter.xcodeproj/project.pbxproj @@ -411,7 +411,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 4BC9Y2LL4B; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -426,7 +426,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = com.atridad.MagicCounter; PRODUCT_NAME = "$(TARGET_NAME)"; STRING_CATALOG_GENERATE_SYMBOLS = YES; @@ -446,7 +446,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 4BC9Y2LL4B; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -461,7 +461,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = com.atridad.MagicCounter; PRODUCT_NAME = "$(TARGET_NAME)"; STRING_CATALOG_GENERATE_SYMBOLS = YES; diff --git a/ios/MagicCounter.xcodeproj/project.xcworkspace/xcuserdata/atridad.xcuserdatad/UserInterfaceState.xcuserstate b/ios/MagicCounter.xcodeproj/project.xcworkspace/xcuserdata/atridad.xcuserdatad/UserInterfaceState.xcuserstate index a5f11eb..e0b4c04 100644 Binary files a/ios/MagicCounter.xcodeproj/project.xcworkspace/xcuserdata/atridad.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/MagicCounter.xcodeproj/project.xcworkspace/xcuserdata/atridad.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ios/MagicCounter/GameView.swift b/ios/MagicCounter/GameView.swift index f64441f..5e68eeb 100644 --- a/ios/MagicCounter/GameView.swift +++ b/ios/MagicCounter/GameView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import UniformTypeIdentifiers /** * Main game screen displaying the grid of players. @@ -17,6 +18,7 @@ struct GameView: View { @State private var gameState: GameState @State private var showingStopConfirmation = false @State private var selectedPlayerForCommander: PlayerState? + @State private var draggedPlayer: PlayerState? init(match: MatchRecord) { self._gameState = State(initialValue: match.state) @@ -97,6 +99,11 @@ struct GameView: View { onScoop: { scoopPlayer(player) } ) .frame(height: 260) + .onDrag { + self.draggedPlayer = player + return NSItemProvider(object: String(player.id) as NSString) + } + .onDrop(of: [.text], delegate: PlayerDropDelegate(item: player, items: $gameState.players, draggedItem: $draggedPlayer)) } } .padding(24) @@ -357,3 +364,30 @@ struct CommanderDamageView: View { } } } + +struct PlayerDropDelegate: DropDelegate { + let item: PlayerState + @Binding var items: [PlayerState] + @Binding var draggedItem: PlayerState? + + func performDrop(info: DropInfo) -> Bool { + return true + } + + func dropEntered(info: DropInfo) { + guard let draggedItem = draggedItem else { return } + if draggedItem.id != item.id { + if let from = items.firstIndex(where: { $0.id == draggedItem.id }), + let to = items.firstIndex(where: { $0.id == item.id }) { + withAnimation { + let movedItem = items.remove(at: from) + items.insert(movedItem, at: to) + } + } + } + } + + func dropUpdated(info: DropInfo) -> DropProposal? { + return DropProposal(operation: .move) + } +} diff --git a/ios/MagicCounter/Logo.icon/icon.json b/ios/MagicCounter/Logo.icon/icon.json index 02e6c94..c290098 100644 --- a/ios/MagicCounter/Logo.icon/icon.json +++ b/ios/MagicCounter/Logo.icon/icon.json @@ -8,7 +8,7 @@ "layers" : [ { "image-name" : "logo 2.png", - "name" : "logo 2", + "name" : "logo", "position" : { "scale" : 0.85, "translation-in-points" : [