# Understanding nullability in GraphQL and Swift with Apollo iOS

DevFeed: [Understanding nullability in GraphQL and Swift with Apollo iOS](<https://devfeed.tech/articles/graphqlnullable-is-not-a-trap-23353.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/graphqlnullable-is-not-a-trap>)

Author: Calvin Cestari

Published: 2023-10-03T09:53:34Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [GraphQL](<https://devfeed.tech/topics/graphql.md>), [Swift](<https://devfeed.tech/topics/swift.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [apollo](<https://devfeed.tech/tags/apollo.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [language](<https://devfeed.tech/tags/language.md>), [languages](<https://devfeed.tech/tags/languages.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [optional](<https://devfeed.tech/tags/optional.md>), [swift](<https://devfeed.tech/tags/swift.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [types](<https://devfeed.tech/tags/types.md>)

## AI overview

This tutorial explains how nullability works in GraphQL and Swift, whose default nullability rules differ, and how Apollo iOS maps nullable GraphQL fields into generated Swift models. It also introduces the semantic distinction between GraphQL nullable and optional values.

## Source excerpt

Nullability is a fundamental concept in many programming languages giving us the ability to express the absence of a value or assigned object. This is particularly relevant in strongly typed languages where each constant or variable must be defined with one of the language data types or explicitly allowed to be null. GraphQL is strongly-typed and all fields are, by default, nullable with being a valid response for any field unless explicitly declared otherwise.