How to use Namespaces in Swift?

后端 未结 8 1925
Happy的楠姐
Happy的楠姐 2020-11-28 01:53

The documentation only mentions nested types, but it\'s not clear if they can be used as namespaces. I haven\'t found any explicit mentioning of namespaces.

8条回答
  •  有刺的猬
    2020-11-28 02:35

    I believe this is achieved using:

    struct Foo
    {
        class Bar
        {
        }
    }
    

    Then it can be accessed using:

    var dds = Foo.Bar();
    

提交回复
热议问题