Skip to content

Redundant conformance of 'CGPoint' to protocol 'Decodable' #145

Description

@agordeev

I'm getting this error when trying to build the project for Test target:

screen shot 2017-03-14 at 11 27 58 am

The code is:

extension CGPoint: Decodable {
    /// Decodes CGPoint from JSON array. Returns CGPoint.zero if array.count < 2.
    ///
    /// - Parameter json: json element
    /// - Returns: CGPoint converted from json
    /// - Throws: error if type mismatch.
    public static func decode(_ json: Any) throws -> CGPoint {
        let array: [Double] = try cast(json)
        let point: CGPoint
        if array.count < 2 {
            print("Can't parse point from array: \(array)")
            point = CGPoint.zero
        } else {
            point = CGPoint(x: array[0], y: array[1])
        }
        return point
    }
}

Everything works fine with main target. Any ideas? Decodable is installed via CocoaPods, version 0.5.

podfile:

use_frameworks!

# ignore all warnings from all pods
inhibit_all_warnings!

def pods
    pod 'Masonry', '0.6.4'
    pod 'Decodable'
    pod 'RealmSwift'
end

target 'App' do
    platform :ios, '9.0'
    pods
end

target 'AppTests' do
    platform :ios, '9.0'
    pods
end

post_install do |installer|
    Dir.glob(installer.sandbox.target_support_files_root + "Pods-*/*.sh").each do |script|
        flag_name = File.basename(script, ".sh") + "-Installation-Flag"
        folder = "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
        file = File.join(folder, flag_name)
        content = File.read(script)
        content.gsub!(/set -e/, "set -e\nKG_FILE=\"#{file}\"\nif [ -f \"$KG_FILE\" ]; then exit 0; fi\nmkdir -p \"#{folder}\"\ntouch \"$KG_FILE\"")
        File.write(script, content)
    end
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions