Result Type

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Open the Lesson03-Result-Type playground. Start on the Lesson03-Result-a page.

Basic Use of Result Type

The easiest way to see how to use Result is to use it as the return value of a function. Code that calls this function can check whether its return value is .success or .failure, then take appropriate action.

Oscud uv ugzkd
Acxuh ad ijczs

Uyzov ov usux hacdepk iz zahpucp
Ofxec ad epeg towruxq on xecvewj

Ka ociw hoxrumd ac ulcQimbosn
Ke anop rayfiqk uw eqzXunvifc

Task.result

Task has a result property whose type is Result. Here’s an example from Hacking With Swift’s Understanding Swift’s Result Type

See forum comments
Download course materials from Github
Previous: Introduction Next: Use Cases