Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在Swift或Objective-C中缩短UIKit的策略_Ios_Objective C_Swift - Fatal编程技术网

Ios 在Swift或Objective-C中缩短UIKit的策略

Ios 在Swift或Objective-C中缩短UIKit的策略,ios,objective-c,swift,Ios,Objective C,Swift,我对UIKit中的iOS开发长名称感到厌烦。 以前,在ObjtoVC.I中,我为自己创建了一个宏文件和目标C++,它缩短了Objtovi-C中的所有长名称,例如 Cell = UITableViewCell Table = UITableView Row = NSIndexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 变成

我对UIKit中的iOS开发长名称感到厌烦。 以前,在ObjtoVC.I中,我为自己创建了一个宏文件和目标C++,它缩短了Objtovi-C中的所有长名称,例如

Cell = UITableViewCell
Table = UITableView
Row = NSIndexPath

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
变成

Cell* cellAtRow(Table* table, Row* row){
//shorten Objective-C++ code
}
我发现这个策略非常有效,可以减少1/4的开发时间。代码仍然易于阅读、开发和测试。唯一的缺点是该项目只能由我自己使用

<> P>但在SWIFT中,没有宏,也没有C++桥,像Objul-C++</P> 现在我对Swift UIKit中的长名字感到厌烦,我想把它再短一点

有人有类似的想法吗?谁有有效的策略来达到同样的效果


使用像objc_msgSend和sel_registerName这样的东西不是一个好的选择,我已经尝试过了,但效果不好。

使用
类型别名

typealias Cell = UITableViewCell
typealias Table = UITableView
typealias Row = IndexPath

在Swift中,使用
indepath
而不是
nsindepath

类型别名声明试试SwiftUI,我想?如果更改它,您的开发时间将减少1/4;教我如何发展。