|
Specifically the bit:
I just don't get what's going on here. |
|
Tha above code is an Extension of EnvironmentValues, which must be a type , if you know in compiler design , we have types, they represent different data that can be adjusted in them and how we can manipulate them. 1) So it ptovies a way to extend the features of type EnvironmentValue 2) the code 3) the value that will be sent to caller site , where it is requested will be dicded by get and set will be allowed to change it or assign. 4) 5) then So yes the code is going to be like this as the compiler needs clear instruction, do not allow words to confuse you , remain focused on logic , its really simple for human mind not for compiler , hence all this code. |
|
I'll take a crack at it, though I'm not 100% sure I'm right. So, But in this example, you are trying to add your own custom-made dictionary entry to be included in when you get the value of it...
The first So, it is basically saying, "When I look in the As an example, if you created a Dictionary like this...
you could get the value of the "cat" key by using this...
and it would return
but in your example, you are basically just using
instead of
|
|
Just a small addition |
|
To clarify just a bit, the
So, since you need to refer to a type when accessing those dictionary values, you use |
|
Certainly! To understand a specific syntax, it would be helpful to provide the code snippet or the specific syntax you would like to learn about. Once you provide the code or syntax, I'll be happy to walk you through its meaning and usage. |
SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.