apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.87k stars 720 forks source link

I can't create a fragment, API.Swfit is error. #2224

Closed KevinLrzsone closed 2 years ago

KevinLrzsone commented 2 years ago

Bug report

I can't create a fragment, API.Swfit is error. eg. The code below: fragment AttendeeDetails on StorefrontProperties { use_in_product_listing

}

and The code below was error public var fragments: Fragments { get { return Fragments(unsafeResultMap: resultMap) } set { resultMap += newValue.resultMap } }

      public struct Fragments {
        public private(set) var resultMap: ResultMap

        public init(unsafeResultMap: ResultMap) {
          self.resultMap = unsafeResultMap
        }

        public var attendeeDetails: AttendeeDetails {
          get {
            return AttendeeDetails(unsafeResultMap: resultMap)
          }
          set {
            resultMap += newValue.resultMap
          }
        }

1648544167761

I have found is Dictionary.Helpers.swift file conflict with SwifterSwift. so, How do I solve。

SwifterSwift extension: /// - Parameters: /// - lhs: dictionary /// - rhs: dictionary static func += (lhs: inout [Key: Value], rhs: [Key: Value]) { rhs.forEach { lhs[$0] = $1} }

Versions

Please fill in the versions you're currently using:

Steps to reproduce

create a fragment, API.Swfit is error.

Further details

Please replace this line with any further details or context necessary to understand the problem. Delete this section if you don't have anything further to add.

AnthonyMDev commented 2 years ago

Since this is a conflict with the SwifterSwift library, we can't really do much about it. I'd recommend generating your Apollo models into a separate library that does not depend on SwifterSwift, then importing that library into the rest of your codebase.