@@ -168,10 +168,16 @@ export class SwiftAPIGenerator extends SwiftGenerator<CompilerContext> {
168168 throw new GraphQLError ( `Unsupported operation type "${ operationType } "` ) ;
169169 }
170170
171+ const {
172+ options : { namespace } ,
173+ fragments
174+ } = this . context ;
175+ const modifiers = ! ! namespace ? [ "final" ] : [ "public" , "final" ] ;
176+
171177 this . classDeclaration (
172178 {
173179 className,
174- modifiers : [ "public" , "final" ] ,
180+ modifiers : modifiers ,
175181 adoptedProtocols : [ protocol ]
176182 } ,
177183 ( ) => {
@@ -184,13 +190,13 @@ export class SwiftAPIGenerator extends SwiftGenerator<CompilerContext> {
184190
185191 const fragmentsReferenced = collectFragmentsReferenced (
186192 operation . selectionSet ,
187- this . context . fragments
193+ fragments
188194 ) ;
189195
190196 if ( this . context . options . generateOperationIds ) {
191197 const { operationId } = generateOperationId (
192198 operation ,
193- this . context . fragments ,
199+ fragments ,
194200 fragmentsReferenced
195201 ) ;
196202 operation . operationId = operationId ;
@@ -343,7 +349,11 @@ export class SwiftAPIGenerator extends SwiftGenerator<CompilerContext> {
343349 before ?: Function ,
344350 after ?: Function
345351 ) {
346- this . structDeclaration ( { structName, adoptedProtocols } , ( ) => {
352+ const {
353+ options : { namespace, mergeInFieldsFromFragmentSpreads }
354+ } = this . context ;
355+
356+ this . structDeclaration ( { structName, adoptedProtocols, namespace } , ( ) => {
347357 if ( before ) {
348358 before ( ) ;
349359 }
@@ -383,7 +393,7 @@ export class SwiftAPIGenerator extends SwiftGenerator<CompilerContext> {
383393
384394 const fields = collectAndMergeFields (
385395 variant ,
386- ! ! this . context . options . mergeInFieldsFromFragmentSpreads
396+ ! ! mergeInFieldsFromFragmentSpreads
387397 ) . map ( field => this . helpers . propertyFromField ( field as Field ) ) ;
388398
389399 const fragmentSpreads = variant . fragmentSpreads . map ( fragmentSpread => {
0 commit comments