An addendum: if something represents a specific “thing” that can’t be
duplicated without consequence, often that means it should be stored in one
specific place in your code, not made into a class.
On Fri, Jun 30, 2017 at 10:10 PM, Brent Royal-Gordon via swift-users <
swift-users@swift.org>
> On Jun 29, 2017, at 10:40 AM, Vitor Navarro via swift-users
> wrote:
>
> Do you guys have any guideline regarding usage here?
Here's my suggestion: Use a class when the object represents a specific *thing*
that can't be duplicated without consequence; use a struct
The Ray Wenderlich style guide contains *some* useful insights, but you
should not take it as a “swift best practices” guide, or even a good code
style guide for your own projects. At the risk of sounding blunt, the RW
style guide is optimized for blog posts and cheap tutorials, not a cohesive
Hi Alex,
Thank you for the reply, actually Taylor gave me a great answer which
solved my question, that was "struct or classes and when should we apply
each".
Regarding the reference I found this
https://github.com/raywenderlich/swift-style-guide#code-organization which
doesn't follow exactly
Hi Taylor,
Thank you for the answer quite enlightening and also a better explanation
than the short direction given by the docs. Could you please provide a
sample for scoping with enums? I couldn't visualize it.
Thanks again.
2017-06-29 14:41 GMT-04:00 Taylor Swift :
>
When in doubt, go with a struct. Probably nineteen types out of twenty I
write are structs. Swift really is optimized with the assumption that
you’re working with structs, that’s why almost everything in the standard
library is a value type. Structs always pack contiguously into arrays,
while
> On 29 Jun 2017, at 18:16, Vitor Navarro via swift-users
> wrote:
>
> Hi,
>
> I know this question is probably done a thousand times, but I wanted to hear
> from Swift dev community.
What is the question?
> I think both of them have right places for usage depending
Hi,
I know this question is probably done a thousand times, but I wanted to
hear from Swift dev community.
I think both of them have right places for usage depending on the occasion
but documentation, WWDC and the internet give opposite answers regarding
this.
Do you guys have any guideline