Михаил Капелько 1 year ago
parent
commit
187af293e9
6 changed files with 33 additions and 20 deletions
  1. +13
    -0
      iOS/app/MMMemory.xcodeproj/project.pbxproj
  2. BIN
      iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate
  3. +1
    -0
      iOS/app/project.yml
  4. +4
    -4
      iOS/src/Main.SectionGrid.swift
  5. +4
    -16
      iOS/src/Model.swift
  6. +11
    -0
      shared/model.iOS.swift

+ 13
- 0
iOS/app/MMMemory.xcodeproj/project.pbxproj View File

@@ -11,6 +11,7 @@
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 */; };
A8118182ABE97FA935A1A4F9 /* model.iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3A95F2FA5C43AF82C7A97FC /* model.iOS.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 */; };
@@ -28,10 +29,20 @@
A355A898E25602F45B88CCBA /* Main.Platform.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.Platform.swift; sourceTree = "<group>"; };
A38A1AA6B57483F6B44CDF78 /* Main.Section16Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.Section16Buttons.swift; sourceTree = "<group>"; };
C1742EFC5A1E818780679340 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
E3A95F2FA5C43AF82C7A97FC /* model.iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = model.iOS.swift; sourceTree = "<group>"; };
F16A7DD61EF6CD4FB4E3DE25 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXGroup section */
4F93BC5459F4AF4391816D4A /* shared */ = {
isa = PBXGroup;
children = (
E3A95F2FA5C43AF82C7A97FC /* model.iOS.swift */,
);
name = shared;
path = ../../shared;
sourceTree = "<group>";
};
667BC26EA8068A9FA707FC02 /* src */ = {
isa = PBXGroup;
children = (
@@ -60,6 +71,7 @@
CD7F0F0C9CA1BA5EAFD5CA09 = {
isa = PBXGroup;
children = (
4F93BC5459F4AF4391816D4A /* shared */,
667BC26EA8068A9FA707FC02 /* src */,
AE7B74413EC292E802CC5C70 /* Products */,
);
@@ -134,6 +146,7 @@
3D03666F3BC2B1F2CBB49530 /* Main.SectionSelection.swift in Sources */,
DB1010B8A246D47BEC6B3FA6 /* Main.swift in Sources */,
89086E3972F560A9A1A76CE4 /* Model.swift in Sources */,
A8118182ABE97FA935A1A4F9 /* model.iOS.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};


BIN
iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate View File


+ 1
- 0
iOS/app/project.yml View File

@@ -8,6 +8,7 @@ targets:
deploymentTarget: "16.0"
sources:
- path: "../src"
- path: "../../shared/model.iOS.swift"
settings:
base:
INFOPLIST_FILE: Info.plist

+ 4
- 4
iOS/src/Main.SectionGrid.swift View File

@@ -14,10 +14,10 @@ extension Main {
let btn = core.buttons[id]
btn.frame =
CGRect(
x: p.0,
y: p.1,
width: memorySide(),
height: memorySide()
x: CGFloat(p.0),
y: CGFloat(p.1),
width: CGFloat(memorySide()),
height: CGFloat(memorySide())
)
btn.backgroundColor = .blue
}


+ 4
- 16
iOS/src/Model.swift View File

@@ -4,23 +4,11 @@ struct M {
var itemsCount: Int = 16
}

func memorySide() -> CGFloat {
return 50
}

func memorySpace() -> CGFloat {
return 20
}

func memoryGap() -> CGFloat {
return memorySide() + memorySpace()
}

func memoryItemPositions(_ M: M) -> [(CGFloat, CGFloat)] {
var pos = [(CGFloat, CGFloat)]()
func memoryItemPositions(_ M: M) -> [(Float, Float)] {
var pos = [(Float, Float)]()
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 row = floor(Float(i) / 4)
let x = memoryGap() + (Float(i) - row * 4) * memoryGap()
let y = memoryGap() + row * memoryGap()
pos.append((x, y))
}


+ 11
- 0
shared/model.iOS.swift View File

@@ -0,0 +1,11 @@
func memorySide() -> Float {
return 50
}

func memorySpace() -> Float {
return 20
}

func memoryGap() -> Float {
return memorySide() + memorySpace()
}

Loading…
Cancel
Save