sunshinejr / SwiftyUserDefaults

Modern Swift API for NSUserDefaults
http://radex.io/swift/nsuserdefaults/static
MIT License
4.85k stars 365 forks source link

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

Open marwamelfeky opened 4 years ago

marwamelfeky commented 4 years ago

This issue suddenly occurs with xcode 11.3.1 any help

sunshinejr commented 4 years ago

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

marwamelfeky commented 4 years ago

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 notifications@github.com 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

sunshinejr commented 4 years ago

@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?

marwamelfeky commented 4 years ago

Swift 5 Xcode 13.3.1 macOS Catalina 10.1.3

On Sun, Feb 2, 2020 at 3:42 PM Łukasz Mróz notifications@github.com 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

QaiserAbbas commented 4 years ago

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