Update 'Home'

master
Claire 2 years ago
parent
commit
e0ffe5ea5e
  1. 5
      Home.md

5
Home.md

@ -452,7 +452,10 @@ Swift is strongly-typed, so we need to use the same number type for every argume
## Building the menu
Back in our `updateIcon()` function, we're first going to create a new dictionary to hold our filter results. Then we're going to populate this dictionary by calling [`Dictionary.filter()`](https://developer.apple.com/documentation/swift/dictionary/filter(_:)) with our fitler function, `findPhase()`.
Back in our `updateIcon()` function, we're first going to create a new dictionary to hold our filter results. Then we're going to populate this dictionary by calling [`Dictionary.filter()`](https://developer.apple.com/documentation/swift/dictionary/filter(_:)) with our filter function, `findPhase()`.
We can use the special variable `$0` to access the array element currently running through our `findPhase()` filter function. Since our function takes [`Double`](https://developer.apple.com/documentation/swift/double) numbers as arguments, we'll convert the string value in `phaseArray` to a [`Double`](https://developer.apple.com/documentation/swift/double) - this is why we used [`NSString`](https://developer.apple.com/documentation/foundation/nsstring) instead of [`String`](https://developer.apple.com/documentation/swift/string) as the values in `phaseArray`.
```swift
@objc func updateIcon() {
...

Loading…
Cancel
Save