[SR-12480] Passing object with wrapped properties don't allow compile
swift-ci opened this issue · 1 comments
swift-ci commented
| 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 commented
Comment by Travis (JIRA)
The Storage object values should be optional.