如何在 Swift 的嵌套结构中初始化嵌套结构和 运行 方法?

How do you initialise Nested Structures and run methods within nested structures in Swift?

我有一个Class。 class 具有作为结构的变量,其中一些结构具有结构作为带有方法的变量。

当我 运行 程序并通过调试时,我可以看到我的 class 变量,但作为结构的变量只是 nil。

我已经将所有 class 定义和结构定义包含在屏幕截图以及我的调用和调试屏幕中...任何帮助都会很棒。

正在尝试呼叫

CLASS-->Struct(细节)-->Struct(位置)-->StructMethod(ConfigLocation)

好的,这是屏幕截图。

和代码。

尝试:

struct SV_StinkDetails_Model {

    // ...

    var SV_StinkDetails_Location:SV_StinkLocation_Model! = SV_StringLocation_Model()
    //...                                                    Just remove `?` here ^

SV_StinkLocation_Model?()表示Optional<SV_StinkLocation_Model>()。 returns nilSV_StinkLocation_Model? 类型。