Ukuzisa iNew SwiftUI Entsha @AppStorage, @StateObject, kunye ne @SceneStorage Property Wrappers

Ibhlog

Ukuzisa iNew SwiftUI Entsha @AppStorage, @StateObject, kunye ne @SceneStorage Property Wrappers

I-SwiftUI ifumene izincedisi ezitsha ngexesha le-WWDC 2020. Phakathi kwezinto ebezime ngaphandle zizongezo kwimpahla yokugcina izinto ye-SwiftUI. Izinto ezisongelayo zepropathi zisetyenziswa kakhulu kwizicelo zeSwiftUI zokuhlaziya kunye nokujonga izimvo kwaye ziyinxalenye ebalulekileyo kulawulo lwedatha ye-SwiftUI.

IOS 14 isinika izinto ezintathu ezisongelayo zokuqhubeka kwedatha:

  • @AppStorage
  • @StateObject
  • @SceneStorage

Kumacandelo ambalwa alandelayo, siza kujonga nganye kwi-Xcode 12 entsha (kwi-beta ngexesha lokubhalwa).


Entsha SceneStorage Ipropathi iluncedo ekubuyiselweni ngurhulumente kwizicelo ezinenkxaso yeefestile ezininzi- eyakhelwe kakhulu kwi-iPadOS nakwi-macOS.

Ngokungafaniyo AppStorage, ayigcini idatha kwi UserDefaults. Endaweni yoko, yipropathi yelizwe kuphela eyahlukileyo kwindawo nganye yesicelo sakho.

@SceneStorage('isLoggedIn') var isLoggedIn = false

#mobile #swiftui #swift #programming #ios

ephakathi.com

Ukuzisa iNew SwiftUI Entsha @AppStorage, @StateObject, kunye ne @SceneStorage Property Wrappers

IOS 14 izisa iipropathi ezintsha ezisonga iipropathi zedatha eqhubekayo kwi-SwiftUI Yazisa ngeSwiftUI Entsha @AppStorage, @StateObject, kunye ne @SceneStorage Property Wrappers