Skip to content

Instantly share code, notes, and snippets.

@carlossless
Last active November 19, 2015 15:11
Show Gist options
  • Save carlossless/e27eec9c6ce0ff13780f to your computer and use it in GitHub Desktop.
Save carlossless/e27eec9c6ce0ff13780f to your computer and use it in GitHub Desktop.
Linker Failure when assigning a protocol with a getter for a struct property in a different framework
import Foundation
import ModuleB
public protocol CacheableConfiguration: Decodable {
static var fileName: String { get }
var version: Int { get } // this is what is triggering the linker fail
func object() -> AnyObject
}
extension QuestsConfiguration: CacheableConfiguration {
public static let fileName = "quest_config.json"
public func object() -> AnyObject {
return [
"version": version,
"daily_limit": dailyLimit,
"reset_time": resetTime,
"templates": templates.map { $0.object() }
]
}
}
extension QuestTemplate {
public func object() -> AnyObject {
return [
"type": type,
"title": title,
"steps": steps,
"skill": skill,
"reward": reward
]
}
}
import Foundation
public struct QuestTemplate {
public var type: String
public var title: String
public var steps: Int
public var reward: Int
public var skill: String
public init(type: String, title: String, steps: Int, reward: Int, skill: String)
}
extension QuestTemplate : Decodable {
public static func decode(j: Argo.JSON) -> Argo.Decoded<Minerva.QuestTemplate>
}
public struct QuestsConfiguration {
public var version: Int
public var dailyLimit: Int
public var resetTime: String
public var templates: [Minerva.QuestTemplate]
public init(version: Int, dailyLimit: Int, resetTime: String, template: [Minerva.QuestTemplate])
}
extension QuestsConfiguration : Decodable {
public static func decode(j: Argo.JSON) -> Argo.Decoded<Minerva.QuestsConfiguration>
}
public protocol Decodable {
typealias DecodedType = Self
public static func decode(json: Argo.JSON) -> Argo.Decoded<Self.DecodedType>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment