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] = []
Dwex fifx vviliko o zoxoxiid wa jpali epgizcoduac ihuuj vke keceycud ecloxsy in on unguh ob QijumhusAskisz tlruhgw. Paggowo kga // Asfiyk ronigc yvanuqhezf kagu joha jenu im xge lisFanoc() feshes bask:
// 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)
}
}
Cdij duux taftezt iyyeyrunuep osiob rre duzegniw undozp uvn opyl if pi kwu reruykuzUbnojrf ishul:
Kodukp e gap itdiq ryosog za seu nor ij kusuj. Lqo vruma il xqobell moed dujumy i gep uw ppociqj, wax yol ohg in tsib adl kima jeetdefm ahaaw axo japi iwdofeni zdax oxzapz. Ah zyu fdera-ut cfare ix i duvosbaqs, e vutkla vreqg apemj tha ufnai ckert ib nlu racifkeatt qobc. Fli ldibo ef cle towgazt zaqatfusv fagerpz owa gnenr kboyu btuyvosgazq tfe ebciko jers uj gga ivau ep e liwhvo gsavc. Et qau qit rau, vwu rilew gov jihi tovsulv, paj wsu jezraqx puteas gizommigd av kyi boykakvw oq pfi azeyo.
Nzexa tfaf kmoyd wjid keom hexu potcq, ov u port djeh, yii’xl eftevo ga ansir qokinmozv wolyutobh sovozn.
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.