SwiftyUserDefaults icon indicating copy to clipboard operation
SwiftyUserDefaults copied to clipboard

Cannot subscript a value of type 'DefaultsAdapter<DefaultsKeys>' with an argument of type 'DefaultsKey<String?>'

Open marwamelfeky opened this issue 5 years ago • 5 comments

This issue suddenly occurs with xcode 11.3.1 any help

marwamelfeky avatar Feb 02 '20 08:02 marwamelfeky

hey @marwamelfeky can you copy-paste a sample code that produces that error?

sunshinejr avatar Feb 02 '20 13:02 sunshinejr

Hi,

Thanks for your fast response , I appreciate your effort

This is the code:

//extension DefaultsKeys {

// public static let DIDNT_LOGIN_NOTIFICATION = "DIDNT_LOGIN_NOTIFICATION";

// static let KEY_API_IP = DefaultsKey<String?>("API_IP");

// static let KEY_DIDNT_LOGIN_NOTIFICATION = DefaultsKey<String?>("DIDNT_LOGIN_NOTIFICATION");

// static let KEY_SELECTED_COUNTRY = DefaultsKey<String?>("SELECTED_COUNTRY");

// static let KEY_IS_WELCOME_SCREEN_SEEN = DefaultsKey<Bool?>("WELCOME_SCREEN_STATUS");

//}

The code that causes the error is:

        Defaults[.KEY_SELECTED_COUNTRY] = countryCode3;

and countryCode3 is a String

On Sun, Feb 2, 2020 at 3:01 PM Łukasz Mróz [email protected] wrote:

hey @marwamelfeky https://github.com/marwamelfeky can you copy-paste a sample code that produces that error?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sunshinejr/SwiftyUserDefaults/issues/230?email_source=notifications&email_token=ABDBQVM2VN5P3GP3NYPX6QLRA272NA5CNFSM4KOYIUJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRWHYA#issuecomment-581133280, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDBQVLTNFAFHZMWVXB3VQDRA272NANCNFSM4KOYIUJQ .

-- Marwa Mohammed Elfeky Senior iOS Developer Mobile : 01225471355

marwamelfeky avatar Feb 02 '20 13:02 marwamelfeky

@marwamelfeky what is the Swift version you use? Also, what version of SwiftyUserDefaults do you use? I see static keys which means probably version 4?

sunshinejr avatar Feb 02 '20 13:02 sunshinejr

Swift 5 Xcode 13.3.1 macOS Catalina 10.1.3

On Sun, Feb 2, 2020 at 3:42 PM Łukasz Mróz [email protected] wrote:

@marwamelfeky https://github.com/marwamelfeky what is the Swift version you usr?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sunshinejr/SwiftyUserDefaults/issues/230?email_source=notifications&email_token=ABDBQVM7B724M7GHP6CD6IDRA3EUBA5CNFSM4KOYIUJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRXDNI#issuecomment-581136821, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDBQVNBDMKALIIAB3OUGXDRA3EUBANCNFSM4KOYIUJQ .

-- Marwa Mohammed Elfeky Senior iOS Developer Mobile : 01225471355

marwamelfeky avatar Feb 02 '20 14:02 marwamelfeky

any progress on this one? How you have solved this?

QaiserAbbas avatar Apr 25 '20 08:04 QaiserAbbas