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


It is like compiler substitution :)


To understand associatedtypes:

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


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