diff --git a/iOS/app/MMMemory.xcodeproj/project.pbxproj b/iOS/app/MMMemory.xcodeproj/project.pbxproj index 0f7c78b..cf84228 100644 --- a/iOS/app/MMMemory.xcodeproj/project.pbxproj +++ b/iOS/app/MMMemory.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 1F083A14C69F20A6BA92A63E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F16A7DD61EF6CD4FB4E3DE25 /* AppDelegate.swift */; }; 3D03666F3BC2B1F2CBB49530 /* Main.SectionSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D5F2B2E3A26F03F6825608E /* Main.SectionSelection.swift */; }; 79FB208C9DADDA6179E588C3 /* Main.SectionGrid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AC22F19366076CF4168BFBD /* Main.SectionGrid.swift */; }; + 89086E3972F560A9A1A76CE4 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C71EDBDFFDBC96F6E8E7762 /* Model.swift */; }; B19B3998FA2BA651ACB1E53C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C1742EFC5A1E818780679340 /* Assets.xcassets */; }; CAFD870CA84084E45011CC23 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4E32B0495E4BCEA4EE0508D4 /* LaunchScreen.storyboard */; }; D505E64F4CD6EAEB530BF851 /* Main.Section16Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = A38A1AA6B57483F6B44CDF78 /* Main.Section16Buttons.swift */; }; @@ -22,6 +23,7 @@ 4E32B0495E4BCEA4EE0508D4 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 6D5F2B2E3A26F03F6825608E /* Main.SectionSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.SectionSelection.swift; sourceTree = ""; }; 9AC22F19366076CF4168BFBD /* Main.SectionGrid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.SectionGrid.swift; sourceTree = ""; }; + 9C71EDBDFFDBC96F6E8E7762 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; 9D774FEE86833E8A0A74387C /* App.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; A355A898E25602F45B88CCBA /* Main.Platform.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.Platform.swift; sourceTree = ""; }; A38A1AA6B57483F6B44CDF78 /* Main.Section16Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.Section16Buttons.swift; sourceTree = ""; }; @@ -41,6 +43,7 @@ 9AC22F19366076CF4168BFBD /* Main.SectionGrid.swift */, 6D5F2B2E3A26F03F6825608E /* Main.SectionSelection.swift */, 0DF762100A8EDF105B6E136D /* Main.swift */, + 9C71EDBDFFDBC96F6E8E7762 /* Model.swift */, ); name = src; path = ../src; @@ -130,6 +133,7 @@ 79FB208C9DADDA6179E588C3 /* Main.SectionGrid.swift in Sources */, 3D03666F3BC2B1F2CBB49530 /* Main.SectionSelection.swift in Sources */, DB1010B8A246D47BEC6B3FA6 /* Main.swift in Sources */, + 89086E3972F560A9A1A76CE4 /* Model.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate b/iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate index 1c6ecbb..f7b47a2 100644 Binary files a/iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate and b/iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iOS/src/Model.swift b/iOS/src/Model.swift new file mode 100644 index 0000000..0e25dc3 --- /dev/null +++ b/iOS/src/Model.swift @@ -0,0 +1,28 @@ +import Foundation + +protocol MItemsCount { + var itemsCount: Int { get } +} + +func memorySide() -> CGFloat { + return 50 +} + +func memorySpace() -> CGFloat { + return 20 +} + +func memoryGap() -> CGFloat { + return memorySide() + memorySpace() +} + +func memoryItemPositions(M: MItemsCount) -> [(CGFloat, CGFloat)] { + var pos = [(CGFloat, CGFloat)]() + for i in stride(from: 0, to: M.itemsCount, by: 1) { + let row = floor(Double(i) / 4) + let x = memoryGap() + (Double(i) - row * 4) * memoryGap() + let y = memoryGap() + row * memoryGap() + pos.append((x, y)) + } + return pos +}