Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
agordeev opened this issue Mar 14, 2017 · 1 comment
Open

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

agordeev opened this issue Mar 14, 2017 · 1 comment

Comments

@agordeev
Copy link

agordeev commented Mar 14, 2017

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
@jsonfellin
Copy link

I'm facing a similar issue. Did you solve this by chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants