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 标签的是用户自定义的代码块,可以手动删除。
相关推荐
用户0931 分钟前
Flutter构建速度深度优化指南
android·flutter·ios
namehu4 小时前
搞定 iOS App 测试包分发,也就这么简单!😎
前端·ios·app
用户098 小时前
如何避免写垃圾代码:iOS开发篇
ios·swiftui·swift
HarderCoder1 天前
iOS 知识积累第一弹:从 struct 到 APP 生命周期的全景复盘
ios
叽哥1 天前
Flutter Riverpod上手指南
android·flutter·ios
大熊猫侯佩2 天前
桃花岛 Xcode 构建秘籍:Swift 中的 “Feature Flags” 心法
app·xcode·swift
悄然林静2 天前
Mac终端执行`brew doctor`报`openssl@1.1`警告
mac·xcode·apple
用户092 天前
SwiftUI Charts 函数绘图完全指南
ios·swiftui·swift
YungFan2 天前
iOS26适配指南之UIColor
ios·swift
权咚3 天前
阿权的开发经验小集
git·ios·xcode