With Xcode 10.2, a warning is now emitted when a public class/struct exists within a public extension.
For example, using apollo codegen:generate --target=swift --namespace="MyNamespace" and the following generated code:
import Apollo
public extension MyNamespace {
public final class MyQuery: GraphQLQuery {
}
public struct MyFragment: GraphQLFragment {
}
}
Swift will emit the warning 'public' modifier is redundant for class declared in a public extension for the MyQuery class and MyFragment struct.
The solution is to simply not include the public modifier for MyQuery when using a namespace.
This is not a language change, just a new warning. The fix should be compatible with all versions of Swift 4.
Note that it's quite common for Swift projects to treat warnings as errors, so this bug is a blocker for us.
Versions
Apollo 2.8.1
With Xcode 10.2, a warning is now emitted when a public class/struct exists within a public extension.
For example, using
apollo codegen:generate --target=swift --namespace="MyNamespace"and the following generated code:Swift will emit the warning
'public' modifier is redundant for class declared in a public extensionfor theMyQueryclass andMyFragmentstruct.The solution is to simply not include the
publicmodifier forMyQuerywhen using a namespace.This is not a language change, just a new warning. The fix should be compatible with all versions of Swift 4.
Note that it's quite common for Swift projects to treat warnings as errors, so this bug is a blocker for us.
Versions
Apollo 2.8.1