Михаил Капелько 1 年之前
父節點
當前提交
0966feb3f8
共有 8 個檔案被更改,包括 62 行新增18 行删除
  1. +4
    -4
      iOS/app/MMMemory.xcodeproj/project.pbxproj
  2. 二進制
      iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate
  3. +23
    -0
      iOS/src/platfrom.swift
  4. +0
    -3
      iOS/src/uts.swift
  5. +3
    -2
      shared/swift.swift
  6. +22
    -1
      toSwift
  7. +1
    -8
      будущее
  8. +9
    -0
      прошлое

+ 4
- 4
iOS/app/MMMemory.xcodeproj/project.pbxproj 查看文件

@@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
1F083A14C69F20A6BA92A63E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F16A7DD61EF6CD4FB4E3DE25 /* AppDelegate.swift */; };
3D03666F3BC2B1F2CBB49530 /* Main.SectionSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D5F2B2E3A26F03F6825608E /* Main.SectionSelection.swift */; };
4AC2B8BF716272D446F9E7E0 /* uts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 721855DB1A329E65128E36B5 /* uts.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 */; };
@@ -18,13 +17,14 @@
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 */; };
F368609CC7635D385838A386 /* platfrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F3E3A0EC0B9264E001C3DBC /* platfrom.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0DF762100A8EDF105B6E136D /* Main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.swift; sourceTree = "<group>"; };
0F3E3A0EC0B9264E001C3DBC /* platfrom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = platfrom.swift; sourceTree = "<group>"; };
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>"; };
721855DB1A329E65128E36B5 /* uts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = uts.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; };
@@ -57,7 +57,7 @@
6D5F2B2E3A26F03F6825608E /* Main.SectionSelection.swift */,
0DF762100A8EDF105B6E136D /* Main.swift */,
9C71EDBDFFDBC96F6E8E7762 /* Model.swift */,
721855DB1A329E65128E36B5 /* uts.swift */,
0F3E3A0EC0B9264E001C3DBC /* platfrom.swift */,
);
name = src;
path = ../src;
@@ -149,8 +149,8 @@
3D03666F3BC2B1F2CBB49530 /* Main.SectionSelection.swift in Sources */,
DB1010B8A246D47BEC6B3FA6 /* Main.swift in Sources */,
89086E3972F560A9A1A76CE4 /* Model.swift in Sources */,
F368609CC7635D385838A386 /* platfrom.swift in Sources */,
BE2994BF2FFF272E62883953 /* swift.swift in Sources */,
4AC2B8BF716272D446F9E7E0 /* uts.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};


二進制
iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate 查看文件


+ 23
- 0
iOS/src/platfrom.swift 查看文件

@@ -0,0 +1,23 @@
import Foundation

// Memory.

struct PositionInstance: Position {
var x: Float
var y: Float
}

func memoryCreatePosition(_ x: Float, _ y: Float) -> PositionInstance {
return .init(x: x, y: y)
}


// UTS.

func utsFloor(_ value: Float) -> Float {
floor(value)
}

func utsIndexArray(_ count: Float) -> [Int] {
[Int](0..<Int(count))
}

+ 0
- 3
iOS/src/uts.swift 查看文件

@@ -1,3 +0,0 @@
func utsIndexArray(_ count: Float) -> [Int] {
[Int](0..<Int(count))
}

+ 3
- 2
shared/swift.swift 查看文件

@@ -24,13 +24,14 @@ func memoryItemPositions(c: Context) -> [Position] {
// @ts-ignore
let ids = utsIndexArray(c.itemsCount);
ids.forEach(i => {
ids.forEach { ii in
let i = Float(ii);
// @ts-ignore
let row = utsFloor(i / 4)
let x = memoryGap() + (i - row * 4) * memoryGap()
let y = memoryGap() + row * memoryGap()
// @ts-ignore
pos.push(memoryCreatePosition(x, y))
})
}
return pos
}

+ 22
- 1
toSwift 查看文件

@@ -15,6 +15,7 @@ let globalReplacements = {
"number": "Float",
"):": ") ->",
"interface": "protocol",
"})": "}", // forEach
};

console.log(`Converting '${fileSrc}' to '${fileDst}'`);
@@ -40,11 +41,31 @@ function convert(line) {
}
result = protocolReplace(result);
result = typeArrayReplace(result);
result = forEachReplace(result);
return result;
}

var isProtocol = false;

// x.forEach(y => { -> x.forEach { y in
function forEachReplace(line) {
if (!line.includes("forEach")) {
return line;
}

let partsFE = line.split("forEach");
let identifier = partsFE[0];
let closure = partsFE[1];

let partsC = closure.split(" => ");
let bracketAndVar = partsC[0];
let bracket = partsC[1];
let variable = bracketAndVar.substring(1);
let result = `${identifier}forEach { ${variable} in`;
return result;
}


var isProtocol = false;
// interface -> protocol
function protocolReplace(line) {
if (line.includes("protocol")) {


+ 1
- 8
будущее 查看文件

@@ -1,13 +1,6 @@
09.06: 19:00-

* заменить for на forEach в TS
* ввести функцию заполнения массива индексами: utsIndexArray
* ввести utsFloor
* ввести utsIndexArray в Swift

НАДО:
* ввести utsFloor в Swift
* конвертировать forEach
* поправить Floor i/4
* перейти на один файл swift
* генерить memoryItemPositions.swift
* ввести общую библиотеку?


+ 9
- 0
прошлое 查看文件

@@ -1,3 +1,12 @@
09.06: 60

* заменить for на forEach в TS
* ввести функцию заполнения массива индексами: utsIndexArray
* ввести utsFloor
* ввести utsIndexArray в Swift
* конвертировать forEach
* ввести utsFloor в Swift

08.06: 30

* перейти на один файл ts


Loading…
取消
儲存