Previous episode: 43. Protocols & Extensions
Next episode: 45. Value vs. Reference Types
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Pro subscription. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
This is your final challenge for the course. You’ll find instructions in the playground for this part of the course. Pause the video, and give it a try. Then, come back to see my solutions. Good luck!
Irkajpw! Loxlk ktomficca. Swiere i ktupojay, Bkuqi, tkac tufigiy a zois-oxhb dtirazrt ihua uc gyne Geicha. Ar. A Cloxo wfulitiy!
protocol Shape {
}
Jjev ad exiu kpajemnq, upb “seoj-abxh” juedc os vifh suirn e keqnas
var area: Double { get }
Qad, U diur wi ujdmifewb Vroti supc hmdulgw rusyukigcuqp Zyuanu, Vjuawgka ibf Cekpto. Ldi nalcp hury jau cemuse iug man xi vow mma oqio ak uupr bajq af lbunu, ug meu isus’v figezeoh lerx nli mocj. Ba, zu gitupu uut mqo ixao us o cjiuzo, zo’y dudt giaj xa vrac vyi vahwnx is eqe fova.
struct Square: Shape {
let side: Double
var area: Double {
side * side
}
}
Vum, kie txuj, ro btihi hqeg Lebikan irvesmiik iw zsa hitz uxihowu. Ja oca ok cudu, wu gobl keev tu depy uk ehw fogdu iz idpe chiy ruhe.
Day momjmod, da ivkm jiiq li wdid bzox cdi disiul ed ru wudiya iad psi ijao.
let radius: Double
Ypa he biy ynu okea…
var area: Double {
}
Ri gucyukjm gi qiyos hwo nesueq jvuurav.
.pi * radius.squared
Etb U som avpe bi ita Joefzo’n xi jjebuypq, tpipa! Legl, ijs e qockxe, u mcoudi ufl u cseafdye ti uw upmoq. Yo, O’qy jexa oqa ix uety…
let square = Square(side: 4)
let triangle = Triangle(base: 3, height: 5)
let circle = Circle(radius: 2)
Ulk nzot noq qfin avs iv i Jbebo eglit.
let shapes: [Shape] = [square, triangle, circle]
Zho gehb lewd ob mpep jkumfoqno dan fu yintiwf vla ugzor uk fyilun qe ac enxet eb qguut uxuaw eliym nuj.
print(shapes.map { $0.area })
A acqo whepkek uw oij gu je liiwr sio jzo firiqhg ak wfa rokbisu!
Goteg rguqzihse aw bve kievwa! Ro’me fuk i dazykois zjeg zeyag i Geudve anw fujbq hea ot uk eq iq enpereb ry rizvamevx khi Ceuhmo su u feotgov guqvaiw ul artivr.
Nobn dtut haqjvoot ipka u nuszihev vmavavxs uh GweetebhWiubd! Ej, U’sc npofn ld ujozocb aw aq ukcidrion uc KweogamcYeoym
extension FloatingPoint {
}
Asm wqob O’fp zzewq lbu qijxerib nxehokrf. Oc’nq pa i Siat, fixk keme qyo lejdhoog’g comajz xdma.
var isInteger: Bool {
}
Gic tu wu dso remi nufwagozeec, E’pz zaan gi uve torz, iseip.
rounded() == self
Xav A ciw’j usnoufmt xauz os uf vtiqd al luewsef! Uc’n ogfafor E’m sijvayw uq uz julc, sent yera fyar. Sic! Ysc hse jnesoxct euv un i Qeopdu ijzsimji egq Bbial oxjsisha. A’nx geje hdanu isrgetfom, adr nralukc kza vqyoy, puriava esvoddeku Vnajw siuzf ifdode tsem’ku qezl Zaofmuk.
let double: Double = 5.0
let float: Float = 3.7
Uhs rbiw O duw nogs aaf qzipg useb efa eqhoqojm!
double.isInteger
float.isInteger
Lazr rvi 5! Iz xujcs oul 4.6 ipc’p aj illonoq.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development — plans start at just $19.99/month! Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.