这是一个PM的BLOG
  • 首页
  • 归档
  • 分类
  • 标签
  • 关于

Swift 权限修饰关键字

private : private 修饰的属性或方法只能在当前类中使用;当调用不在当前类中,即使是当前类相关对象也不能使用 private 修饰的Class或Struct 在除在自身内部使用;其它的都不被允许(包括类的继承和实例化),因此一般开发中不会用private 修饰Class 和Struct private 修饰的protocol,只允许在当前文件中遵循该protocol;其它的都是不被允
2024-12-09
随笔
#Swift

Swift 判断字符串是否为 nil 或者 empty

12345var myString: String? = nilif (myString ?? "").isEmpty { print("String is nil or empty")}
2024-12-09
随笔
#Swift

SwiftUI NavigationStack 与 NavigationSplitView 合集

NavigationStackSwiftUI 4.0 的全新导航系统 使用 SwiftUI 的 NavigationStack 组件进行页面导航 自定义你的 NavigationStack 导航栏外观 跳转的几种方式12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505
2024-12-09
合集
#SwiftUI

SwiftUI @Published 与 onReceive 组合使用

123456789101112131415161718192021222324252627import SwiftUIstruct ContentView: View { @StateObject private var state: ContentViewState = .init() var body: some View { VStack 
2024-12-09
随笔
#SwiftUI

SwiftUI ForEach 警告 Non-constant range: argument must be an integer literal

这个 Warning 的字面意思是「非常数范围:参数必须是整数字面量。」所以除非是常数,比如直接用「0..<4」这样的代码消除这个警告,但是大多数情况下,我们不可能去这样写,因为这部分 View 就是动态生成的。 123ForEach(0..<4) { index in} 查阅官方文档: The instance only reads the initial v
2024-12-09
随笔
#SwiftUI

Xcode Logger 合集

使用更方便 debug 程式的 Logger 列印訊息 使用Logger取代print()在Xcode上輸出訊息
2024-12-09
合集
#Xcode

Xcode 更换主题

前往 ~/Library/Developer/Xcode/UserData/FontAndColorThemes/ 把下载好的 .xcolortheme 文件放进去重启 Xcode 就行了。 需要注意的是,与其说是主题,更像是配色主题。字体以及字体大小都需要自己设置。 Xcode 主题下载: XCode Themes
2024-12-06
随笔
#Xcode

macOS 工程报错 Error: Error Domain=NSPOSIXErrorDomain Code=1 「Operation not permitted」

在 macOS 工程中调试接口时出现报错: 123Error: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" UserInfo={_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <E0BD2CC5-BC74-4624-
2024-12-02
随笔
#Network #Xcode

Swift 发送 GET/POST 请求

GET123456789101112131415161718192021222324252627282930313233343536373839404142434445var urlComponents = URLComponents(string: "your url")!// 查询条件urlComponents.queryItems = [ URLQueryItem(
2024-11-29
随笔
#Swift #Network

SwiftUI LabeledContent 合集

参考:LabeledContent in SwiftUI 下面代码: 123456789101112131415161718192021222324252627282930313233343536373839404142434445struct ContentView: View { var body: some View { Form {
2024-11-29
合集
#SwiftUI
1…56789…29

搜索

Hexo Fluid
总访问量 次 总访客数 人