我已将第三方 Pod 添加到我的项目中。虽然我可以在调试目标中很好地构建应用程序。一旦我尝试使用发布目标构建我的项目,我就会收到此构建错误。
Failed to build module 'XXXX' from its module interface; the compiler that produced it, 'Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)'
我不知道为什么它只在发布目标上出现这个问题,而在调试目标上却没有。
这里任何形式的帮助都会非常有帮助。我使用的是 Xcode 12.5
我有一个协议
protocol doSomethingProtocol {
associatedtype someType
}
Run Code Online (Sandbox Code Playgroud)
然后我有一个正在实现这个协议的类
class doSomethingClass : doSomethingProtocol {
typealias someType = Int
}
Run Code Online (Sandbox Code Playgroud)
现在我想使用这个协议作为其他类的参考
class someClass : ObservableObject {
private var reference : doSomethingProtocol
}
Run Code Online (Sandbox Code Playgroud)
现在我不能这样做,因为doSomethingProtocol有关联类型。所以我决定使用some
class someClass : ObservableObject {
private var reference : some doSomethingProtocol
init(){
reference = doSomethingClass()
}
}
Run Code Online (Sandbox Code Playgroud)
然而这不起作用。我得到了错误Property declares an opaque return type, but has no initializer expression from which to infer an underlying type。为什么 ?我在类 init 中给它初始化表达式。
但是当我做这样的事情时
class someClass : ObservableObject { …Run Code Online (Sandbox Code Playgroud) 我正在查看以下代码
public class Solution {
public boolean judgeSquareSum(int c) {
for (long a = 0; a * a <= c; a++) {
for (long b = 0; b * b <= c; b++) {
if (a * a + b * b == c)
return true;
}
}
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
作者说这段代码的时间复杂度是?c。我不明白的是如何。
所以假设我们给出了一个 c=20 的例子。那么代码将运行 15 次但是?20=4.47
big-o ×1
ios ×1
java ×1
nested-loops ×1
objective-c ×1
opaque-types ×1
protocols ×1
swift ×1
swift5 ×1
xcode ×1
xcode12 ×1