I want to use same struct in two different objects and provide it between them.
Hi @observerward, can you rephrase your question and or give a sort of sample of what you are trying to achieve please? I do not fully understand your question.
Nevermind. I discovered that all classes and structs are available everywhere.
@observerward It’s also a good idea to put things like structs and classes in their own files. As you say, you can then use them in other structs and classes.
If you want find out more about why and how different classes or structs are visible between different modules, check out ‘Access Control’ section from Swift documentation.
https://docs.swift.org/swift-book/LanguageGuide/AccessControl.html
Hi @observerward,
You can make them available depending on how you want them to be , by default most of the source code that you will find makes them globally available. While commercial and larger projects place them in namespaces and also make them available selectively.
cheers,
This topic was automatically closed after 166 days. New replies are no longer allowed.