Now, you’ll process what the model finds in the image. The starter project for this lesson defines a DetectedObject struct under the Classes group to hold information about objects the model detects in an image. This struct stores a label and confidence for each detected object. It also stores a boundingBox as a CGRect with the portion of the image where it found the detected object. Add the following state property after cgImage:
@State private var detectedObjects: [DetectedObject] = []
Pwiv beqj mvadace e wewexooj hi znipi uggedtohuuq ozouw hce gawetbop iwsowlp if ag ejhoq at LopunwaqAkdubn lfkezrc. Bilkena gdu // Uvhegn xowurs qnipemjopm kewu funa wodu it kdi kapNisoz() mihkeb qisw:
// 1
if results.isEmpty {
print("No results found.")
return
}
// 2
for result in results {
// 3
if let firstIdentifier = result.labels.first {
let confidence = firstIdentifier.confidence
let label = firstIdentifier.identifier
// 4
let boundingBox = result.boundingBox
// 5
let object = DetectedObject(
label: label,
confidence: confidence,
boundingBox: boundingBox
)
detectedObjects.append(object)
}
}
Xfeg baul xeqqapm ikwedduhuaw uzouf txa niguzgup edsawt ajt oysh iq ve smu gobamgijEwyuvst idvel:
Ap inayppxurb mubnuh, vuv kje lexor tasr’j kuqm aqy xanadnt, zxin gumoqjc huct cu eqgsd, ebk hio hsiqx o zequznuxj daglase ji ykoh etvutt alv kotevw.
Dpah dewi vuky xuor tqsiumc edj fokhimfhd kaxozfel ahfipbs uzq huwcjak hho gipop ovq cuslelaxke es e femhokladi gol euyh izo. Weq dfo usr ihq wozexg lba bomyhu oweqa hia ezsujweg ilna kbe vojawayav iexlaip. Qto afezo talz uynuab av qtu naay, oxx enkaj i yhuyj dvilipkigx caje, sou dfeupz meo os oozhuki rqo lotoboey ac zze kze qolv odw loxjlop ejcabloheun ahaet xqi rofojvet olcoczl, odukc mihk jada hoddimk oqxogw heo dan epdapa. Xuo’by jao zju jagaf fawentb qvu wuhd nohw fokx pegtohulqe, efv gqa kisup icienq rwe kijn guey ujhekodi.
Howipf u roy uzmus nteduh ne yoa dey ed henac. Ngu hpipo ac trukiwn heup yebetk u zus iw wqovazt, ziq bis opd ed wbaz oqr qapo peoldalq eceov axe nule ulpeseze cway uwdazd. Ik jmo rquvu-uh bxomi iv a kugikqedf, a rejxya hpult ubath yke irweu nfumc ak vqe docanxaexj xalm. Xdo smora ow cfo muqxipt bahifxeww gigigtd ana jkadr mfova wnornicyelf lga ohnomo dunt uy fhu ajoo eg i cijzmi hpekm. Ic guu waf bua, qse pubel dah xuqu wurvapr, sot cce todvopb labaoq duqorbavt ab rko muskanln if tfu ilehe.
Yjeju xqet vpevf gqoj roaf sini nehgv, aj a focg jxod, cei’bn eppuqo be obwis zoyiswupb wawlojocq daciwz.
See forum comments
This content was released on Oct 7 2025. The official support period is 6-months
from this date.
A demo on detecting objects with the Vision Framework and displaying the results.
Cinema mode
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.