Михаил Капелько 1 year ago
parent
commit
6612cfcbd2
8 changed files with 67 additions and 51 deletions
  1. +16
    -20
      iOS/app/MMMemory.xcodeproj/project.pbxproj
  2. BIN
      iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate
  3. +1
    -1
      iOS/src/AppDelegate.swift
  4. +4
    -1
      iOS/src/Main.Platform.swift
  5. +21
    -0
      iOS/src/Main.Section16Buttons.swift
  6. +25
    -0
      iOS/src/Main.SectionGrid.swift
  7. +0
    -0
      iOS/src/Main.swift
  8. +0
    -29
      iOS/src/Main/Main.Section16Buttons.swift

+ 16
- 20
iOS/app/MMMemory.xcodeproj/project.pbxproj View File

@@ -8,41 +8,36 @@

/* Begin PBXBuildFile section */
1F083A14C69F20A6BA92A63E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F16A7DD61EF6CD4FB4E3DE25 /* AppDelegate.swift */; };
A6E529FBA0467549623E44A5 /* Main.Section16Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032C8E87061765718F550E70 /* Main.Section16Buttons.swift */; };
AEDC5FB14A2EE027C2F7FDA7 /* Main.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC87DC40D65BB2748668CE65 /* Main.swift */; };
79FB208C9DADDA6179E588C3 /* Main.SectionGrid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AC22F19366076CF4168BFBD /* Main.SectionGrid.swift */; };
B19B3998FA2BA651ACB1E53C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C1742EFC5A1E818780679340 /* Assets.xcassets */; };
CAFD870CA84084E45011CC23 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4E32B0495E4BCEA4EE0508D4 /* LaunchScreen.storyboard */; };
D65ED8EB653B36E6C4094996 /* Main.VC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EAF8AC4A5A1BCE77350565E /* Main.VC.swift */; };
D505E64F4CD6EAEB530BF851 /* Main.Section16Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = A38A1AA6B57483F6B44CDF78 /* Main.Section16Buttons.swift */; };
DB1010B8A246D47BEC6B3FA6 /* Main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DF762100A8EDF105B6E136D /* Main.swift */; };
EB8CC50236A211D932BA0DB0 /* Main.Platform.swift in Sources */ = {isa = PBXBuildFile; fileRef = A355A898E25602F45B88CCBA /* Main.Platform.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
032C8E87061765718F550E70 /* Main.Section16Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.Section16Buttons.swift; sourceTree = "<group>"; };
0DF762100A8EDF105B6E136D /* Main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.swift; sourceTree = "<group>"; };
4E32B0495E4BCEA4EE0508D4 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
6EAF8AC4A5A1BCE77350565E /* Main.VC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.VC.swift; sourceTree = "<group>"; };
9AC22F19366076CF4168BFBD /* Main.SectionGrid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.SectionGrid.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>"; };
C1742EFC5A1E818780679340 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
CC87DC40D65BB2748668CE65 /* Main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.swift; sourceTree = "<group>"; };
F16A7DD61EF6CD4FB4E3DE25 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXGroup section */
43F40869C11E8EE85952F2E9 /* Main */ = {
isa = PBXGroup;
children = (
032C8E87061765718F550E70 /* Main.Section16Buttons.swift */,
CC87DC40D65BB2748668CE65 /* Main.swift */,
6EAF8AC4A5A1BCE77350565E /* Main.VC.swift */,
);
path = Main;
sourceTree = "<group>";
};
667BC26EA8068A9FA707FC02 /* src */ = {
isa = PBXGroup;
children = (
F16A7DD61EF6CD4FB4E3DE25 /* AppDelegate.swift */,
C1742EFC5A1E818780679340 /* Assets.xcassets */,
4E32B0495E4BCEA4EE0508D4 /* LaunchScreen.storyboard */,
43F40869C11E8EE85952F2E9 /* Main */,
A355A898E25602F45B88CCBA /* Main.Platform.swift */,
A38A1AA6B57483F6B44CDF78 /* Main.Section16Buttons.swift */,
9AC22F19366076CF4168BFBD /* Main.SectionGrid.swift */,
0DF762100A8EDF105B6E136D /* Main.swift */,
);
name = src;
path = ../src;
@@ -127,9 +122,10 @@
buildActionMask = 2147483647;
files = (
1F083A14C69F20A6BA92A63E /* AppDelegate.swift in Sources */,
A6E529FBA0467549623E44A5 /* Main.Section16Buttons.swift in Sources */,
D65ED8EB653B36E6C4094996 /* Main.VC.swift in Sources */,
AEDC5FB14A2EE027C2F7FDA7 /* Main.swift in Sources */,
EB8CC50236A211D932BA0DB0 /* Main.Platform.swift in Sources */,
D505E64F4CD6EAEB530BF851 /* Main.Section16Buttons.swift in Sources */,
79FB208C9DADDA6179E588C3 /* Main.SectionGrid.swift in Sources */,
DB1010B8A246D47BEC6B3FA6 /* Main.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};


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


+ 1
- 1
iOS/src/AppDelegate.swift View File

@@ -11,7 +11,7 @@ extension AppDelegate {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = Main.VC()
window?.rootViewController = Main.Core()
window?.makeKeyAndVisible()

return true


iOS/src/Main/Main.VC.swift → iOS/src/Main.Platform.swift View File

@@ -1,7 +1,9 @@
import UIKit

// MARK: - Ядро-VC

extension Main {
class VC: UIViewController {
class Core: UIViewController {
var buttons = [UIButton]()

override func viewDidLoad() {
@@ -10,6 +12,7 @@ extension Main {
view.backgroundColor = .white

Main.Section16Buttons.setupCore(self)
Main.SectionGrid.setupCore(self)
}
}
}

+ 21
- 0
iOS/src/Main.Section16Buttons.swift View File

@@ -0,0 +1,21 @@
import UIKit

// MARK: - Протоколы

protocol MainSection16Buttons { }

// MARK: - Реализация

extension Main {
enum Section16Buttons {
static func setupCore(_ core: Main.Core) {
// Создаём 16 кнопок.
for i in 0..<16 {
let btn = UIButton()
btn.tag = i
core.view.addSubview(btn)
core.buttons.append(btn)
}
}
}
}

+ 25
- 0
iOS/src/Main.SectionGrid.swift View File

@@ -0,0 +1,25 @@
import UIKit

// MARK: - Протоколы

protocol MainSectionGrid { }

// MARK: - Реализация

extension Main {
enum SectionGrid {
static func setupCore(_ core: Main.Core) {
let side = 50
let space = 20
let gap = side + space

// Расставляем кнопки в сетке 4x4.
for btn in core.buttons {
let id = btn.tag
let row = Int(id / 4)
btn.frame = CGRect(x: gap + (id - row * 4) * gap, y: gap + row * gap, width: side, height: side)
btn.backgroundColor = .blue
}
}
}
}

iOS/src/Main/Main.swift → iOS/src/Main.swift View File


+ 0
- 29
iOS/src/Main/Main.Section16Buttons.swift View File

@@ -1,29 +0,0 @@
import UIKit

// MARK: - Протоколы

protocol MainSection16Buttons {
}

// MARK: - Реализация

extension Main {
enum Section16Buttons {
static func setupCore(_ core: Main.VC) {
// Создаём 16 кнопок.
for i in 0..<16 {
let btn = UIButton()
core.buttons.append(btn)
btn.tag = i
//????btn.addTarget(self, action: #selector(selectButton), for: .touchUpInside)
core.view.addSubview(btn)
}
// Расставляем их в сетке 4x4.
for btn in core.buttons {
btn.frame = CGRect(x: 0, y: btn.tag * 60, width: 50, height: 50)
btn.backgroundColor = .blue
}
}
}
}

Loading…
Cancel
Save