最佳答案
在屏幕 1 中,settingsDb
变量在全局命名空间中声明,在这种情况下声明顺序很重要,因此必须在使用之前声明所有类型的顶级声明。
如果需要更多详细信息,请查找“swift top-level”,developer.apple.com 官方博客为 here
关于Swift/Xcode 奇怪的行为 : "Use of undeclared type" error shown in case of struct used before declaration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59509241/