Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
Swift 返回类型说明
我看到一个 Swift 函数写如下 func calculation imageRef CGImage gt red UInt green UInt blue UInt 我需要知道上面函数的返回类型是什么 我无法将它与任何已知类型联系起来
ios
Objectivec
swift
swift4
使用可编码的值,有时是 Int,有时是 String
我有一个 API 有时会返回特定的键值 在本例中id 在 JSON 中作为 Int 有时它会以 String 的形式返回相同的键值 如何使用 codable 来解析该 JSON struct GeneralProduct Codable v
json
swift
swift4
Codable
来自字符串的 Swift Keypath
有没有办法在 Swift 4 中从字符串创建 Keypath 以通过路径或变量名访问结构中的值 最后我发现我应该使用 CodingKeys 而不是 KeyPaths 通过 String 访问结构体变量的值 提前致谢 迈克尔 考虑你有这样的东
swift4
keypaths
在 Swift 4 IOS 中将 XML 数据获取到 String 中
我有一个 XML 字符串格式 我想使用 Swift 4 从它获取单个值到字符串变量 我的数据如下 let myString Adasdnajinasdshabjdbaiusd Encrypted Text Sample let MyResu
ios
swift
xml
swift4
表达式类型不明确,没有更多上下文 swift 4.0
我正在实施pod Socket IO Client Swift but in SocketEngine swift文件我收到此错误 private func handleBase64 message String binary in bas
ios
swift
swift4
swift 4.0:覆盖“prepare”必须与其覆盖的声明一样可用
我试图将 Apple 的 ARKit 示例应用程序集成到我的应用程序中 由于ARKit只是一个附加功能 所以我需要支持较低版本的iOS 我向所有 ARKit 示例应用程序类添加了 available iOS 11 0 标签 它几乎可以工作
ios
swift
swift4
Xcode9
ARKit
UIApplication.registerForRemoteNotifications() 必须仅从主线程调用
Xcode 9 iOS 11 在注册推送 远程 通知时向我显示错误 警告 这是错误消息 这是我尝试过的代码 let center UNUserNotificationCenter current center delegate self c
ios
swift
pushnotification
swift4
unusernotificationcenter
Xcode 9/Swift 4 AVCaptureMetadataOutput setMetadataObjectTypes 使用 availableMetadataObjectTypes
似乎有很多与我遇到的问题类似的问题 AVmetadata 随着 swift 4 xcode 9 的变化 https stackoverflow com questions 46286332 avmetadata changes with s
ios
AVFoundation
swift4
Xcode9
在 Swift 4 中,扩展声明还不能被覆盖
我最近将我的代码迁移到Swift 4 我面临一个问题扩展 i e 扩展的声明还不能被覆盖 我已经阅读了多篇重新评估此问题的帖子 但他们都不接受下面描述的场景 class BaseCell UITableViewCell Some code
ios
swift
swift4
extensionmethods
Swift 与 Objective C 指针操作问题
我在 Objective C 中有这段代码 运行良好 list controller gt audioBufferList list gt mBuffers 0 mDataByteSize inNumberFrames kSampleWor
ios
Objectivec
swift
swift4
coreaudio
Apple 推送通知 (APN) 不一致?
通过 APN 使用 Apple 的推送通知时 我们遇到了一个令人困惑的问题 我们有以下场景 我猜是相当标准的 当我们的应用程序 我们在这里称之为 MyApp 首次安装并启动时 我们会请求用户授予通过 MyApp 向他发送推送通知的权限 在此
ios
swift
pushnotification
applepushnotifications
swift4
Swift 4 JSON Codable - 返回的值有时是一个对象,其他是一个数组
我从 API 获取的数据返回单个对象 但当有多个对象时 它会返回同一键中的数组 对于我正在使用的当前模型 结构 当数组出现时解码会失败 这些结果是随机排序的 这意味着我不知道何时会收到对象或数组 有没有办法创建一个模型 考虑到这一事实 并可
Arrays
json
swift
swift4
Codable
如何重构代码以在主线程上调用 AppDelegate?
我最近开始将我的项目从 Swift 3 Xcode 迁移到 Swift 4 Xcode 我的应用程序在运行时崩溃 因为主线程清理程序允许访问UIApplication shared delegate仅在主线程上 导致启动时崩溃 我有以下代码
ios
swift
Multithreading
swift4
Bool.hashValue 转换为 Int 有效吗?
在某些情况下和一些代码我看到hashValue用于转换Bool to Int 然而 代码 let someValue true let someOtherValue false print someValue hashValue print
swift
Hash
typeconversion
Boolean
swift4
隐藏或删除导航栏按钮项目中的特定项目,Swift 4
从导航栏中隐藏或删除特定按钮项目UIBarButtonItem这是从故事板给出的 例如右侧导航栏项目我添加了 3UIBarButtonItem就像情节提要中的 完成 取消 下一步 现在我想根据用户登录以编程方式从导航栏中删除或隐藏 取消 按
ios
swift
uinavigationbar
swift4
UIBarButtonItem
Swift 4 中键值编码的优势
我只是想知道 Swift 4 中键值编码的好处 因为我很了解键值编码 保留对属性的引用 而不实际访问属性所持有的基础数据 例如 struct Student var name String var rollNo String let stu
swift
swift4
“StorageMetadata”类型的值没有成员“downloadURL”
我刚刚将 Firebase Storage 更新到 5 0 0 看起来像metadata downloadURL 不再被认可 Value of type StorageMetadata has no member downloadURL 尽
swift
xcode
firebase
swift4
firebasestorage
在swift ios中多线程并行执行多个任务
我知道队列的创建并且能够执行单个任务 但如何并行执行多个任务 并发队列 gt let concurrentQueue DispatchQueue label com some concurrentQueue attributes concu
ios
swift
Multithreading
swift4
dispatchqueue
Swift 4 用变量作为键解析 json [重复]
这个问题在这里已经有答案了 我试图了解苹果添加的新 Codable 功能 但我无法解决这个问题 我有一个 json 输出 如下所示 Afpak id 1 race hybrid flavors Earthy Chemical Pine ef
json
swift
Parsing
Dictionary
swift4
如何解码不同类型的 JSON 属性? [复制]
这个问题在这里已经有答案了 我有一个 JSON tvShow id 5348 name Supernatural permalink supernatural url http www episodate com tv show super
json
swift
Alamofire
swift4
decodable
1
2
3
4
5
6
...8
»