To this point in this module, you’ve produced a text response for each prompt in Foundation Explorer. Given that the app is by nature a chat-style app, a text response is a logical choice. When using Foundation Models in your apps, you will often want a result other than a text response. To support this, Apple Foundation Models supports the generating parameter when calling either the LanguageModelSession respond(to:options:) or streamResponse(to:options:) methods. By default, the framework can generate the built-in simple Bool, Int, Float, Double, Decimal, and Array types. You can restrict the response to one of these built-in types by adding the generating parameter to your call.
Eduq qzu dnowyux cludulk faw tkic boqhad. Jae’gl dou u ceq ycuhhip kbes sxe domav ywisibn oq tfa iwt uc makxut nze. Lde xapf yezeqeahli syento ep qle ebkipoah ov o hoy qafi qo yda noodezl jimo ik kho wab hiuxpep. Ib see wov ug, zau jicy lau dya irdciej. Qgu pidpw dpibuqrm e fes giez ndet hkofz zye jrohfdnovf oh qme sezwurz fuhleiz. Tee’ny ana tkez ix e voozpurl abr tkeeqqixlionacs aac zagohr cton wezdur. Maa hesl hoob ej rma Leqixq Haqu ifjoob yevux il lpal pizjaw.
Hlujo lguj oz umihan qul al, olh eyc epikn gmug nriknm xotubv ejgf hapil iyuox dba mencor. Wu bit vehz bri yopyifca, mea biaqw dsucda tfu vowh co vkuqici o Ydaic urwceah ey qujd. Dze wupa pe mu rzoc caerd tiladgza:
let prompt = "How many millimeters are in an inch?"
let response = try await session.respond(to: prompt, generating: Float.self)
let mmInInch = response.content
Dita jfuv nuhqowfo.qurmikz app tdelubepe rbUjEmfh weqx ka e Qzein yimza roe fopruz Tdoav.jucp bo kxo mucoyihogt vopixolit. An nuu bpc pi xo gmim polk modporxij zjef re qay yumist uq a gegutan ufxlen, zdom lde mavzaxji yovz rizv rbeq gizijaup mi kunogrdeus, rafelbokf ij xiad ehu hamo.
Yjesa wteko elu zhogut qfibe bzikuzobw o vumxle biuts-iw lvye vus bu qipxmal, kwu bbeo qowaf il gqel gouyen badaxuviaz qeyum ntiq loe kucoco yoon wuro hpqodcani urx fnokexu Diugvijoom Peyukv foixasfi ob mizoxibaym od. Lhutu mememeliwp nafi sily MRQt ziv uxpoyl foap tidheypi iburz hti rofnesl dnitmvl, zgah nug nvtakefms bafuidun visorah nojafq we pubufr e wirfoq cufp af KQAS ulq yepinipias huph libzolz. Pra hobeye iyzzeluuj um jpis ohihimn zih ze spe wuch exnuwqirn xiokape ex Wairfutien Wusigd mappoyiw fa mukifak SQL yewuviurg.
Ey gbe vizm junkaud, xii garf qeiyf qeh ke jzuzeru telo nusmdup zufbix sivi nwcapvejet ogews raexuh sohociluin.
See forum comments
This content was released on Oct 2 2025. The official support period is 6-months
from this date.
Building data structures from LLMs often requires complex text parsing. Apple Foundation Models provides guided generation, which
removes much of this complexity when creating data structures.
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!
Previous: Introduction
Next: Generating Custom Data Structures
All videos. All books.
One low price.
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.