appstorage

Can @AppStorage be used in the Environment in SwiftUI?

老子叫甜甜 提交于 2021-01-28 05:05:14
问题 Can @AppStorage be used in the Environment in SwiftUI, if so, how would you do it? I know you can send the value for the @AppStorage from one view to another using @Bindings as a general wondering I would like to know if its possible to put it in the environment. I don't have a practical example as to when this would be applicable, but I was wondering if it was possible. Would this be crazy enough to work? I think you will only store the value and it won't be stored in the UserDefault. struct

Can @AppStorage be used in the Environment in SwiftUI?

柔情痞子 提交于 2021-01-28 05:00:46
问题 Can @AppStorage be used in the Environment in SwiftUI, if so, how would you do it? I know you can send the value for the @AppStorage from one view to another using @Bindings as a general wondering I would like to know if its possible to put it in the environment. I don't have a practical example as to when this would be applicable, but I was wondering if it was possible. Would this be crazy enough to work? I think you will only store the value and it won't be stored in the UserDefault. struct