Михаил Капелько 1 year ago
parent
commit
3f051f3b82
8 changed files with 65 additions and 7 deletions
  1. BIN
      .будущее.swp
  2. +13
    -0
      iOS/app/MMMemory.xcodeproj/project.pbxproj
  3. BIN
      iOS/app/MMMemory.xcodeproj/project.xcworkspace/xcuserdata/mk.xcuserdatad/UserInterfaceState.xcuserstate
  4. +1
    -0
      iOS/app/project.yml
  5. +3
    -0
      shared/Swift/memorySide.swift
  6. +0
    -4
      shared/model.iOS.swift
  7. +39
    -1
      toSwift
  8. +9
    -2
      будущее

BIN
.будущее.swp View File


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

@@ -9,6 +9,7 @@
/* 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 */; };
3EA747EF132EF00B60CE3BA8 /* memorySide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E6ABD013AB08F7DF11C069 /* memorySide.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 */; };
@@ -21,6 +22,7 @@

/* Begin PBXFileReference section */
0DF762100A8EDF105B6E136D /* Main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.swift; sourceTree = "<group>"; };
17E6ABD013AB08F7DF11C069 /* memorySide.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = memorySide.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>"; };
9AC22F19366076CF4168BFBD /* Main.SectionGrid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.SectionGrid.swift; sourceTree = "<group>"; };
@@ -34,6 +36,15 @@
/* End PBXFileReference section */

/* Begin PBXGroup section */
44681273C081F5991624384F /* Swift */ = {
isa = PBXGroup;
children = (
17E6ABD013AB08F7DF11C069 /* memorySide.swift */,
);
name = Swift;
path = ../../shared/Swift;
sourceTree = "<group>";
};
4F93BC5459F4AF4391816D4A /* shared */ = {
isa = PBXGroup;
children = (
@@ -73,6 +84,7 @@
children = (
4F93BC5459F4AF4391816D4A /* shared */,
667BC26EA8068A9FA707FC02 /* src */,
44681273C081F5991624384F /* Swift */,
AE7B74413EC292E802CC5C70 /* Products */,
);
sourceTree = "<group>";
@@ -146,6 +158,7 @@
3D03666F3BC2B1F2CBB49530 /* Main.SectionSelection.swift in Sources */,
DB1010B8A246D47BEC6B3FA6 /* Main.swift in Sources */,
89086E3972F560A9A1A76CE4 /* Model.swift in Sources */,
3EA747EF132EF00B60CE3BA8 /* memorySide.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/Swift"
- path: "../../shared/model.iOS.swift"
settings:
base:


+ 3
- 0
shared/Swift/memorySide.swift View File

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

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

@@ -1,7 +1,3 @@
func memorySide() -> Float {
return 50
}

func memorySpace() -> Float {
return 20
}


+ 39
- 1
toSwift View File

@@ -1,3 +1,41 @@
#!/usr/bin/env node

console.log("Converting to Swift");
if (process.argv.length < 4) {
console.error("Usage: toSwift SRC DST");
process.exit(1);
}

var fs = require("fs");

let fileSrc = process.argv[2];
let fileDst = process.argv[3];

let replacements = {
"function": "func",
"number": "Float",
"):": ") ->",
};

console.log(`Converting '${fileSrc}' to '${fileDst}'`);

var linesDst = [];
let linesSrc = fs.readFileSync(fileSrc).toString().split(/\r?\n/);
for (let i in linesSrc) {
let ln = linesSrc[i];
linesDst.push(convert(ln));
}

let contentsDst = linesDst.join("\r\n");
fs.writeFileSync(fileDst, contentsDst);


// Functions making decisions.

function convert(line) {
var result = line;
for (let src in replacements) {
let dst = replacements[src];
result = result.replace(src, dst);
}
return result;
}

+ 9
- 2
будущее View File

@@ -1,8 +1,15 @@
НАДО:
* принимать на вход в toSwift аргументы
01.06: 19.20-
* сообщать Usage
* принимать на вход в toSwift аргументы
* вывести файл построчно
* ввести словарь замен

НАДО:
* сохранять в файл
* конвертить memorySide из TS в Swift
* генерить memorySide.swift
* генерить остальные функции-константы
* использовать сгенеренные js и swift в проектах
* ввести общую библиотеку
* генерить itemPositions

Loading…
Cancel
Save