San*_*ago 5 scheduler ios swift
我尝试在 iOS Playground 中使用Scheduler,但收到如下错误:
expression failed to parse:
error: Playground.playground:46:8: error: 'Scheduler' is only available in iOS 13.0 or newer; clients of '__lldb_expr_10' may have a lower deployment target
S: Scheduler, S.SchedulerTimeType == SchedulerTimeType, S.SchedulerOptions == SchedulerOptions
Run Code Online (Sandbox Code Playgroud)
我不知道在哪里设置部署目标,因为它是一个独立的文件,而不是工作区或项目。有人可以帮忙吗?
小智 4
如果您使用 Playground,则需要显式导入或表示您将要使用的所有内容。
因此,在您的情况下,您可以将 @available(iOS 13.0, *) 属性添加到使用 Scheduler 的函数的属性中。
当我尝试在 Playground 中使用 CGFloat 时,我遇到了同样的问题。这有帮助。
@available(iOS 2.0, *)
public func width(string: String, withConstrainedHeight height: CGFloat, font: UIFont) -> CGFloat {
let constraintRect = CGSize(width: .greatestFiniteMagnitude, height: height)
let boundingBox = string.boundingRect(with: constraintRect, options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: font], context: nil)
return ceil(boundingBox.width)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
969 次 |
| 最近记录: |