Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-12480] Passing object with wrapped properties don't allow compile #611

Closed
swift-ci opened this issue Apr 1, 2020 · 1 comment
Closed

Comments

@swift-ci
Copy link

swift-ci commented Apr 1, 2020

Previous ID SR-12480
Radar None
Original Reporter itstraviee (JIRA User)
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler, libdispatch, Project Infrastructure
Labels Bug
Assignee @shahmishal
Priority Medium

md5: 1ed89c998b3db62a36ab915bb572f6ac

Issue Description:

I followed this guide on creating wrapped properties with user defaults:

https://www.vadimbulavin.com/advanced-guide-to-userdefaults-in-swift/

Now, I have LocalStorage class which will take this "Storage()" class at the end of the tutorial and then access that object's references to get the data from UserDefaults values. For some reason, when I set a string in my code, it no longer builds/compiles. It works for booleans. An example below:

// make shift example

struct LocalStorage{
    
    var storage: Storage

    init(storage: Storage){
       self.storage = storage
    }

    func ex(){
         storage.username = "travis" // will not compile... "Abort 6" 
         storage.aBoolValue = true // without line above, it will compile
     }

}

Thoughts? Also tested in a fresh project. It still does not compile. "Abort trap: 6"

@swift-ci
Copy link
Author

swift-ci commented Apr 2, 2020

Comment by Travis (JIRA)

The Storage object values should be optional.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant