Network disconnected
Description
아래는 애플와치와 쌍을 이룬 아이폰을 찾는 가상의 코드입니다.(실제 애플와치 앱에서 이런 코드를 사용하는 것은 아닙니다)
optional binding을 써서 빈 칸에 적당한 코드를 작성해주세요.
Fill type challenge HOWTO
- In the Fill type challenge, you have to fill the blank with appropriate code
- The given code except the blank cannot be edited.
- An error message will be shown in the Result area when you leave the blank empty.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Foundation
struct WatchDevice {
var pairediPhone:String? //애플와치와 쌍을 이루는 아이폰의 이름.
var appInstalled = false //어플리케이션의 설치 유무
enum WatchSize {
case m42, m38
}
}
var appleWatch:WatchDevice? = nil
appleWatch = WatchDevice(pairediPhone: "링고스타의 아이폰", appInstalled: true)
// ①appleWatch에 대해 optional binding으로 watch라는 새로운 변수를 생성해주세요.
if {
// ②watch와 쌍을 이루는 아이폰의 이름에 대해
// optional binding으로 phoneName이라는 새로운 변수를 생성해 주세요.
if = watch. {
print ("AppleWatch가 \(phoneName)과 쌍을 이룹니다.")
}
}
Result
Stop
Result of [Run] or [Submit] will be displayed here