美文网首页
简单的使用shell 生成iOS ViewController类

简单的使用shell 生成iOS ViewController类

作者: iOS小开发 | 来源:发表于2019-03-08 09:58 被阅读0次

#!/usr/bin/env bash

export LC_CTYPE=C

ramdomString()

{

openssl rand -base64 64 | tr -cd 'a-zA-Z' |head -c 16

}

className=`ramdomString`

classh="${className}.h"

classm="${className}.m"

touch $classh

touch $classm

echo "#import <UIKit/UIKit.h>"  >>  $classh

echo "@interface" $className ": UIViewController" >> $classh

echo "@end" >> $classh

echo "#import  \""$classh"\"" >> $classm

echo "@interface" $className "()" >> $classm

echo "@end" >> $classm

echo "@implementation"  $className >> $classm

echo "- (void)viewDidLoad {" >> $classm

echo "[super viewDidLoad];" >> $classm

echo "}" >> $classm

echo "- (void)didReceiveMemoryWarning {" >> $classm

echo "[super didReceiveMemoryWarning];" >> $classm

echo "}" >> $classm

echo "@end" >> $classm

相关文章

网友评论

      本文标题:简单的使用shell 生成iOS ViewController类

      本文链接:https://www.haomeiwen.com/subject/eogxcqtx.html