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 标签的是用户自定义的代码块,可以手动删除。
相关推荐
开开心心loky1 天前
[iOS] GCD - 线程与队列
macos·ios·objective-c·cocoa
00后程序员张1 天前
iOS 上架费用全解析 开发者账号、App 审核、工具使用与开心上架(Appuploader)免 Mac 成本优化指南
android·macos·ios·小程序·uni-app·cocoa·iphone
fukai77222 天前
OmniFocus:专为 macOS 与 iOS 打造的专业级任务管理利器
macos·ios
行走的陀螺仪2 天前
Flutter 开发环境配置教程
android·前端·flutter·ios
请叫我飞哥@2 天前
获取 Apple 授权登录的 Token
ios·swiftui·swift
QuantumLeap丶2 天前
《Flutter全栈开发实战指南:从零到高级》- 12 -状态管理Bloc
android·flutter·ios
方君宇2 天前
SwiftUI ScrollView导致视图塌陷(高度为0)问题
ios
2501_916008892 天前
HTTPS 请求抓包,从原理到落地排查的工程化指南(Charles / tcpdump / Wireshark / Sniffmaster)
ios·小程序·https·uni-app·wireshark·iphone·tcpdump