     public required convenience init(from decoder: Decoder) throws {
         let container = try decoder.container(keyedBy: CodingKeys.self)
 
-        self.init()
-
-        self.consumerKey = try container.decode(type(of: self.consumerKey), forKey: .consumerKey)
-        self.consumerSecret = try container.decode(type(of: self.consumerSecret), forKey: .consumerSecret)
+        let consumerKey = try container.decode(String.self, forKey: .consumerKey)
+        let consumerSecret = try container.decode(String.self, forKey: .consumerSecret)
+
+        self.init(consumerKey: consumerKey, consumerSecret: consumerSecret)
+
         self.oauthToken = try container.decode(type(of: self.oauthToken), forKey: .oauthToken)
         self.oauthRefreshToken = try container.decode(type(of: self.oauthRefreshToken), forKey: .oauthRefreshToken)
         self.oauthTokenSecret = try container.decode(type(of: self.oauthTokenSecret), forKey: .oauthTokenSecret)

    /// Cannot declare a required initializer within an extension.
    /// extension OAuthSwiftCredential: NSCoding {
    public required convenience init?(coder decoder: NSCoder) {
        self.init()
        guard let consumerKey = decoder
            .decodeObject(of: NSString.self,
                          forKey: NSCodingKeys.consumerKey) as String? else {

            decoder.failWithError(error)
            return nil
        }

        guard let consumerSecret = decoder
            .decodeObject(of: NSString.self,
