所以我现在用
let listTemplate = CPListTemplate(title: "name", sections: sections) interfaceController?.setRootTemplate(listTemplate, animated: true)
设置模板,但Xcode告诉我:'setRootTemplate(_:animated:)' was deprecated in iOS 14.0有什么新方法可以做到这一点?
'setRootTemplate(_:animated:)' was deprecated in iOS 14.0
nxagd54h1#
使用The New One With Completion In Docs
interfaceController?.setRootTemplate(listTemplate, animated: true,completion:nil)
也可以使用异步版本
Task { do { let listTemplate = CPListTemplate(title: "name", sections: sections) try await interfaceController.setRootTemplate(listTemplate, animated: true) } catch { print(error) } }
1条答案
按热度按时间nxagd54h1#
使用The New One With Completion In Docs
也可以使用异步版本