Михаил Капелько преди 1 година
родител
ревизия
907d4d1b4e
променени са 3 файла, в които са добавени 32 реда и са изтрити 0 реда
  1. +4
    -0
      iOS/app/MMMemory.xcodeproj/project.pbxproj
  2. Двоични данни
      iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate
  3. +28
    -0
      iOS/src/Model.swift

+ 4
- 0
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 = "<group>"; };
6D5F2B2E3A26F03F6825608E /* Main.SectionSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.SectionSelection.swift; sourceTree = "<group>"; };
9AC22F19366076CF4168BFBD /* Main.SectionGrid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.SectionGrid.swift; sourceTree = "<group>"; };
9C71EDBDFFDBC96F6E8E7762 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
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 = "<group>"; };
A38A1AA6B57483F6B44CDF78 /* Main.Section16Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.Section16Buttons.swift; sourceTree = "<group>"; };
@@ -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;
};


Двоични данни
iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate Целия файл


+ 28
- 0
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
}

Loading…
Отказ
Запис