Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ashen-zhao committed Jun 8, 2018
0 parents commit 68c2417
Show file tree
Hide file tree
Showing 5 changed files with 275 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# createSwift
51 changes: 51 additions & 0 deletions SwiftFiles/PnffIdqbVController.swift
Original file line number Diff line number Diff line change
@@ -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<String>()
realArr.append("PnffIdqb")
realArr.append("YkkhbrFpzjqe")
realArr.append("PnffIdqb")
realArr.append("YkkhbrFpzjqe")

}

public func YkkhbrFpzjqeTOVC() {

var realArr = Array<String>()
realArr.append("YkkhbrFpzjqe")
realArr.append("PnffIdqb")
realArr.append("YkkhbrFpzjqe")
realArr.append("YkkhbrFpzjqe")

}

public func QhvzFbqoTOVC() {

var realArr = Array<String>()
realArr.append("QhvzFbqo")
realArr.append("QhvzFbqo")
realArr.append("PnffIdqb")

}

}
58 changes: 58 additions & 0 deletions SwiftFiles/QhvzFbqoVController.swift
Original file line number Diff line number Diff line change
@@ -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<String>()
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<String>()
realArr.append("YkkhbrFpzjqe")
realArr.append("YkkhbrFpzjqe")
realArr.append("QhvzFbqo")
realArr.append("QhvzFbqo")

}

public func QhvzFbqoTOVC() {

var realArr = Array<String>()
realArr.append("QhvzFbqo")
realArr.append("QhvzFbqo")
realArr.append("YkkhbrFpzjqe")
realArr.append("YkkhbrFpzjqe")
realArr.append("QhvzFbqo")
realArr.append("YkkhbrFpzjqe")
realArr.append("YkkhbrFpzjqe")

}

}
57 changes: 57 additions & 0 deletions SwiftFiles/YkkhbrFpzjqeVController.swift
Original file line number Diff line number Diff line change
@@ -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<String>()
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<String>()
realArr.append("QhvzFbqo")
realArr.append("QhvzFbqo")
realArr.append("QhvzFbqo")

}

public func QhvzFbqoTOVC() {

var realArr = Array<String>()
realArr.append("YkkhbrFpzjqe")
realArr.append("YkkhbrFpzjqe")
realArr.append("YkkhbrFpzjqe")
realArr.append("PnffIdqb")
realArr.append("PnffIdqb")
realArr.append("QhvzFbqo")
realArr.append("QhvzFbqo")

}

}
108 changes: 108 additions & 0 deletions toSwift.py
Original file line number Diff line number Diff line change
@@ -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<String>()\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)

0 comments on commit 68c2417

Please sign in to comment.