I am very new to Swift, I come from a C# background but I was junior level there,I have bought some Swift books recently and I am reading them all concurrently to Swift Apprentice, but I am really liking how this book is written.
I thought I was understanding Structs and what is in Chapter 10 until I got to the Mini-Exercise to rewrite IsInDeliveryRange using Location and DeliveryArea…
First, but I go down the wrong rabbit hole, is the exercise to just rewrite the function call at the top of page 221, or the function itself?
I have tried doing both but I keep getting errors saying x and y are not members of Location…
I am trying to use Location.x and Location.y instead of x: (some Int Value, y: (some Int Value)
like IsInDeliveryRange(location: (Location.x, Location.y))
I also tried IsInDeliveryRange(location: (Location.x = 4, Location.y =7))
I was hoping to either hints or answers to the mini exercises.
Note I have not bought the course, just bought this book off of Amazon, but I am really thinking about the course
Did I do it correct? Since the mini exercise called to also use DeliveryArea, I think it meant to rewrite the function… so on that one I think I would be lost on…
I’m not familiar with the exercise, however, if you wrap your code in:
```swift ```
Blocks, it will look like this:
struct Location {
let x: Int
let y: Int
}
struct DeliveryArea {
let center: Location
var radius: Double
}
let storeLocation = Location( x: 3, y: 3)
IsInDeliveryRange(location: (x: storeLocation.x, y: storeLocation.y))
Which is more legible and doesn’t give you artifacts (like the * you saw) in the code.