通过启用数据保护功能来实现
https://developer.apple.com/documentation/widgetkit/creating-a-widget-extension
您需要设置数据保护权限
NSFileProtectionComplete或NSFileProtectionCompleteUnlessOpen,并且设备已锁定。
在Swift 5.5 iOS 15+中,有一个新的ViewModifier
.privacySensitive(true)
View
中。
https://developer.apple.com/videos/play/wwdc2021/10018/