iOS开发代码块-OC版

iOS开发代码块-OC版

资源分享

自提:

通过网盘分享的文件:CodeSnippets 2.zip

链接: https://pan.baidu.com/s/1Yh8q9PbyeNpuYpasG4IiVg?pwd=dn1i 提取码: dn1i

Xcode中的代码片段默认放在下面的目录中:

~/Library/Developer/Xcode/UserData/CodeSnippets

下载代码块文件解压后 复制到上面的目录下即可。

资源使用详情

  • 注释类代码块

    • ltest
    • lmark
  • gcd

    • 主线程 main -- kmain
    • 子线程 back -- kback
    • 全局队列 -- kglobal
  • 属性

    • kbtn
    • klabel
    • knum
    • kassing
    • kstrong
    • kcopy
    • kblock
  • interface IMP

    • kinterface
    • kimp
  • 初始化

    • kinit
    • kinit...
  • model属性

    • klistclass
    • krename
  • for循环

    • kfor
  • 懒加载

    • klazy
  • masonry

    • kmleft
    • kmwidth
    • kmright...

Xcode自带代码块

1.strong:

objc 复制代码
@property (nonatomic,strong) <#Class#> *<#object#>;

2.weak:
@property (nonatomic,weak) <#Class#> *<#object#>;

3.copy:
@property (nonatomic,copy) NSString *<#string#>;

4.assign:
@property (nonatomic,assign) <#Class#> <#property#>;

5.delegate:
@property (nonatomic,weak) id<<#protocol#>> <#delegate#>;

6.block:
@property (nonatomic,copy) <#Block#> <#block#>;

7.mark:
#pragma mark <#mark#>

8.ReUseCell:

objc 复制代码
static NSString rid=<#rid#>;  
 \<#Class#\> *cell=[tableView dequeueReusableCellWithIdentifier:rid]();  
 if(cell==nil){  

 cell=[\[\<#Class#\> alloc]() initWithStyle:UITableViewCellStyleDefault      reuseIdentifier:rid];  
 }  
 return cell;

9.MainGCD:

objc 复制代码
dispatch_async(dispatch_get_main_queue(), ^{  
\<#code#\>  
  });

10.AfterGCD:

objc 复制代码
 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(\<#delayInSeconds#\> * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{  
\<#code to be executed after a specified delay#\>  
});

11.OnceGCD:

objc 复制代码
 static dispatch_once_t onceToken;  
 dispatch_once(&onceToken, ^{  
\<#code to be executed once#\>  
 });

自定义代码块

  • 选中代码块后鼠标右键:
  • Xcode右上角+ 号:



    User 标签的是用户自定义的代码块,可以手动删除。
相关推荐
茶底世界之下2 天前
为什么预览、录制、离线导出不能共享同一个背压策略?
ios·swift
2501_916007472 天前
苹果商店iOS应用上架费用全面解析:开发者计划与审核费用计算
android·ios·小程序·https·uni-app·iphone·webview
2501_916008892 天前
如何实现iOS App代码混淆:SwiftShield使用指南
android·ios·小程序·https·uni-app·iphone·webview
2501_915909062 天前
移动端开发工具链怎么组合比较好,iOS、Android、跨端三套配置方案
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
2501_916008892 天前
怎么用 Godot 导出 iOS 应用并上架 App Store?签名字段该填什么?
android·ios·小程序·https·uni-app·iphone·webview
2501_915918413 天前
iOS编程用什么软件好?主流工具Xcode、AppCode、CodeRunner与新兴快蝎对比
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
终端安全笔记3 天前
iOS 27 之后「策略空转」:设备升级不报错,但旧策略不再管它
android·网络·安全·ios·智能手机
9765033353 天前
iOS 上架 4.3a 被拒【uniapp专讲】
flutter·ios·objective-c·uniapp·swift
黑化旺仔4 天前
【OC】KVO
macos·ios·objective-c·cocoa
HouWan4 天前
SwiftUI 小技巧:如何读取 SwiftUI Font 的详细信息
ios·swiftui·apple