# Custom scalars on the client side - iOS

**URL:** <https://community.apollographql.com/t/custom-scalars-on-the-client-side-ios/6599>\
**Category:** Client SDKs\
**Tags:** client, mobile, ios\
**Created:** [August 15, 2023, 1:31pm UTC](https://community.apollographql.com/t/custom-scalars-on-the-client-side-ios/6599 "2023-08-15T13:31:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sugan](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sugan](https://community.apollographql.com/u/sugan)\
**Post date:** [August 15, 2023, 1:31pm UTC](https://community.apollographql.com/t/custom-scalars-on-the-client-side-ios/6599/1 "2023-08-15T13:31:44Z")

</div>

I’m using Apollo client iOS version 1.0.6. Trying to add custom scalar to my schema and query. Followed the reference [here](https://github.com/apollographql/apollo-client-swift-playground/blob/main/Apollo.playground/Pages/CustomScalars.xcplaygroundpage/Contents.swift) .

Since I’ using configuration json and build script to auto generate schema and query reference here [The Codegen CLI - Apollo GraphQL Docs](https://www.apollographql.com/docs/ios/code-generation/codegen-cli) couldn’t figure out how to pass ```  
–passthroughCustomScalars

```auto
Any suggestion.
Thanks in advance
```

---

<div class="post-metadata">

**Author:** ![ZachF-Apollo](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/zachf-apollo/32/4210_2.png) [@ZachF-Apollo](https://community.apollographql.com/u/ZachF-Apollo)\
**Post date:** [August 15, 2023, 1:58pm UTC](https://community.apollographql.com/t/custom-scalars-on-the-client-side-ios/6599/2 "2023-08-15T13:58:44Z")

</div>

@sugan The reference you linked that mentions using `passthroughCustomScalars` is from the 0.x versions of Apollo. That flag is no longer needed in 1.x versions and your custom scalars will be generated into your operation models and have a typealias created for them that defaults to `String` type but can be overridden by you for custom implementation. For explanation of the change from 0.x to 1.x versions check [this section](https://www.apollographql.com/docs/ios/migrations/1.0#custom-scalars) of our migration guide.

---

<div class="post-metadata">

**Author:** ![sugan](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sugan](https://community.apollographql.com/u/sugan)\
**Post date:** [August 15, 2023, 4:06pm UTC](https://community.apollographql.com/t/custom-scalars-on-the-client-side-ios/6599/3 "2023-08-15T16:06:51Z")

</div>

@ZachF-Apollo, Thank you so much for the quick response. It really helped me.

One question - I have added new scalar in my Scheme i.e scalar CustomValue. But when running generate command it doesn’t create a file under CustomScalars. Do I have add them manually?

Note: Code gen doesn’t throw an error

---

<div class="post-metadata">

**Author:** ![ZachF-Apollo](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/zachf-apollo/32/4210_2.png) [@ZachF-Apollo](https://community.apollographql.com/u/ZachF-Apollo)\
**Post date:** [August 15, 2023, 5:16pm UTC](https://community.apollographql.com/t/custom-scalars-on-the-client-side-ios/6599/4 "2023-08-15T17:16:27Z")

</div>

Is you custom scalar type being used in any operations? If a custom scalar is defined in your schema but not used in any operation then it won’t have a file generated because it’s not needed. Once it is being used in an operation it will be generated, also keep in mind these are only generated once and not re-generated with every codegen run to allow you to make the necessary customization to the typealias without having it overridden by codegen.

---

<div class="post-metadata">

**Author:** ![sugan](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sugan](https://community.apollographql.com/u/sugan)\
**Post date:** [August 16, 2023, 2:57pm UTC](https://community.apollographql.com/t/custom-scalars-on-the-client-side-ios/6599/5 "2023-08-16T14:57:55Z")

</div>

Thanks again. Somehow when I re-generate files are autogenerated.

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:48pm UTC](https://community.apollographql.com/t/custom-scalars-on-the-client-side-ios/6599/6 "2025-02-06T20:48:28Z")

</div>


