diff --git a/README.md b/README.md new file mode 100644 index 0000000..e84c349 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# createSwift diff --git a/SwiftFiles/PnffIdqbVController.swift b/SwiftFiles/PnffIdqbVController.swift new file mode 100644 index 0000000..3c7dc2e --- /dev/null +++ b/SwiftFiles/PnffIdqbVController.swift @@ -0,0 +1,51 @@ +// +// PnffIdqbVController.swift +// Orange + +// Created by Ashen on 18/06/06. +// Copyright © 2018年 BeiLian. All rights reserved. +// + +import UIKit + +class PnffIdqbVController: UIViewController { + + public var PnffIdqb:UIScrollView! + public var YkkhbrFpzjqe:UILabel! + public var QhvzFbqo:UIColor! + + + override func viewDidLoad() { + super.viewDidLoad() + } + + public func PnffIdqbTOVC() { + + var realArr = Array() + realArr.append("PnffIdqb") + realArr.append("YkkhbrFpzjqe") + realArr.append("PnffIdqb") + realArr.append("YkkhbrFpzjqe") + + } + + public func YkkhbrFpzjqeTOVC() { + + var realArr = Array() + realArr.append("YkkhbrFpzjqe") + realArr.append("PnffIdqb") + realArr.append("YkkhbrFpzjqe") + realArr.append("YkkhbrFpzjqe") + + } + + public func QhvzFbqoTOVC() { + + var realArr = Array() + realArr.append("QhvzFbqo") + realArr.append("QhvzFbqo") + realArr.append("PnffIdqb") + + } + +} \ No newline at end of file diff --git a/SwiftFiles/QhvzFbqoVController.swift b/SwiftFiles/QhvzFbqoVController.swift new file mode 100644 index 0000000..78bd365 --- /dev/null +++ b/SwiftFiles/QhvzFbqoVController.swift @@ -0,0 +1,58 @@ +// +// QhvzFbqoVController.swift +// Orange + +// Created by Ashen on 18/06/06. +// Copyright © 2018年 BeiLian. All rights reserved. +// + +import UIKit + +class QhvzFbqoVController: UIViewController { + + public var YkkhbrFpzjqe:UISlider! + public var QhvzFbqo:UIButton! + + + override func viewDidLoad() { + super.viewDidLoad() + } + + public func PnffIdqbTOVC() { + + var realArr = Array() + realArr.append("QhvzFbqo") + realArr.append("PnffIdqb") + realArr.append("QhvzFbqo") + realArr.append("PnffIdqb") + realArr.append("PnffIdqb") + realArr.append("PnffIdqb") + realArr.append("YkkhbrFpzjqe") + realArr.append("PnffIdqb") + + } + + public func YkkhbrFpzjqeTOVC() { + + var realArr = Array() + realArr.append("YkkhbrFpzjqe") + realArr.append("YkkhbrFpzjqe") + realArr.append("QhvzFbqo") + realArr.append("QhvzFbqo") + + } + + public func QhvzFbqoTOVC() { + + var realArr = Array() + realArr.append("QhvzFbqo") + realArr.append("QhvzFbqo") + realArr.append("YkkhbrFpzjqe") + realArr.append("YkkhbrFpzjqe") + realArr.append("QhvzFbqo") + realArr.append("YkkhbrFpzjqe") + realArr.append("YkkhbrFpzjqe") + + } + +} \ No newline at end of file diff --git a/SwiftFiles/YkkhbrFpzjqeVController.swift b/SwiftFiles/YkkhbrFpzjqeVController.swift new file mode 100644 index 0000000..3174572 --- /dev/null +++ b/SwiftFiles/YkkhbrFpzjqeVController.swift @@ -0,0 +1,57 @@ +// +// YkkhbrFpzjqeVController.swift +// Orange + +// Created by Ashen on 18/06/06. +// Copyright © 2018年 BeiLian. All rights reserved. +// + +import UIKit + +class YkkhbrFpzjqeVController: UIViewController { + + public var PnffIdqb:UILabel! + public var YkkhbrFpzjqe:UIColor! + public var QhvzFbqo:UIView! + + + override func viewDidLoad() { + super.viewDidLoad() + } + + public func PnffIdqbTOVC() { + + var realArr = Array() + realArr.append("PnffIdqb") + realArr.append("QhvzFbqo") + realArr.append("PnffIdqb") + realArr.append("QhvzFbqo") + realArr.append("PnffIdqb") + realArr.append("QhvzFbqo") + realArr.append("QhvzFbqo") + + } + + public func YkkhbrFpzjqeTOVC() { + + var realArr = Array() + realArr.append("QhvzFbqo") + realArr.append("QhvzFbqo") + realArr.append("QhvzFbqo") + + } + + public func QhvzFbqoTOVC() { + + var realArr = Array() + realArr.append("YkkhbrFpzjqe") + realArr.append("YkkhbrFpzjqe") + realArr.append("YkkhbrFpzjqe") + realArr.append("PnffIdqb") + realArr.append("PnffIdqb") + realArr.append("QhvzFbqo") + realArr.append("QhvzFbqo") + + } + +} \ No newline at end of file diff --git a/toSwift.py b/toSwift.py new file mode 100644 index 0000000..6edf3cc --- /dev/null +++ b/toSwift.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- + +import random + +import os,sys + +import string + +#创建.swift文件 + +def createSwift(fileNmae,propertyNumber,methodArray): + + full_path = sys.path[0] + '/SwiftFiles/' + fileNmae + '.swift' + + file = open(full_path, 'w') + + file.write('//\n// '+fileNmae+'.swift\n// Orange\n\n// Created by Ashen on 18/06/06.\n// Copyright © 2018年 BeiLian. All rights reserved.\n//\n\n') + + file.write('import UIKit \n\n' + 'class '+fileNmae+': UIViewController {\n\n') + + propryNameArray = [] + + for index in range(1,propertyNumber): + + propryNameArray.append(random.choice(array)) + + propryNameArray = list(set(propryNameArray)) + + for propertyName in propryNameArray: + + file.write(' public var '+propertyName+':'+random.choice(classArray)+'!\n') + + file.write('\n\n') + + file.write(' override func viewDidLoad() {\n super.viewDidLoad()\n }\n\n') + + + for methodName in methodArray: + + file.write(' public func '+methodName+'TOVC() {\n\n var realArr = Array()\n') + + number = random.randint(3, 10) + + for i in range(1,number): + + file.write(' realArr.append("'+random.choice(array)+'")\n') + + file.write('\n }\n\n') + + file.write('}') + + file.close() + + print('Done') + + +def createClassName(): + + first = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + + second = "abcdefghijklmnopqrstuvwxyz" + + index = 0 + + array = [] + + # 设置生成多少个类 + classNumber = 3 + for i in range(classNumber): + + final=(random.choice(first)) + + index = random.randint(3, 5) + + for i in range(index): + + final+=(random.choice(second)) + + final += (random.choice(first)) + + for i in range(index): + + final+=(random.choice(second)) + + array.append(final) + return array + +#属性类型 +classArray = ['UIColor','UILabel','UITableView','UISlider','UIScrollView','UIView','UIButton'] + +array = createClassName() + +array = list(set(array)) + +for name in array: + + number = random.randint(3, 10) + + methodArray = [] + + for i in range(1,5): + + methodArray.append(random.choice(array)) + + methodArray = list(set(methodArray))#数组去重 + + createSwift(name+'VController',number,methodArray) +