I have a struct here, which generates errors when Xcode tries to compile it
public struct GATToIPPermissions : OptionSet {
public init(rawValue: UInt)
public static var read: GATToIPPermissions { get {}}
public static var write: GATToIPPermissions { get {}}
public static var event: GATToIPPermissions { get {}}
public static var all: GATToIPPermissions { get {}}
}
The error I get is Type GATToIPPermissions does not conform to protocol RawRepresentable
. However, I dont get any indication as to why it doesn't conform.
Can any of you spot the problem?
That syntax you're written is what you would use within a
protocol
. If it were in a protocol, it would declare "Conforming types must implement an initializer calledinit(rawValue:)
, and have getters for the following properties of typeGATToIPPermissions
:read
,write
,event
, andall
"But you're not aiming to write declarations in a
protocol
, you're looking to write implementations in astruct
, and here is how that would look: