TLDR:

It is for when you are interested in:
• compiler optimization.
• Generate compile error in-case a new case/property is added.

Applicable to enum and struct constructs.

Targeted at library authors.

NOTE: @frozen is only applicable when developing on something called as Library Evolution mode, introduced in Swift 5.0…


These are access modifiers for the individual methods of a struct or non-class protocols.
These apply also to the getter and setter methods of properties.

To understand these keywords, lets construct a struct MyStruct holding property underlyingValue of type Int:

class MyStruct {
private var underlyingValue: Int = 0
}


Generics for protocols are what they are.

They enable us to write a common protocol that can accomodate variance in data types, for the same names, in the classes that conform to the protocol

(NOTE: THIS IS STATEMENT IS JUST MY ATTEMPT TO DEFINE associatedtype IN A SINGLE SENTENCE. DO…


TLDR;

It is like compiler substitution :)

HTTR;

To understand associatedtypes: https://02infinity.medium.com/understanding-swift-protocol-associated-types-ca717d091b56

I’ve had a hard time wrapping my head around ‘some’ keyword (introduced in swift 5.1). Now that I have that “Ah-ha!” moment, I thought I may be able to help others understand, with this article.

I’ll start with…

Vijay Chandran Jayachandran

Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store