我们都知道苹果在 iOS 13 上引入了 Extensible Enterprise Single Sign-on Extension。下面 是苹果展示的演示视频。
有两种类型的扩展,
我想使用重定向扩展。演示视频中显示的以下代码。
class ViewController: UIViewController {
var authController : ASAuthorizationController?
let authProvider = ASAuthorizationSingleSignOnProvider(identityProvider: URL(string: "https://example.com")!)
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func login(_ sender: Any) {
if self.authProvider.canPerformAuthorization {
let request = self.authProvider.createRequest()
request.requestedOperation = ASAuthorization.OpenIDOperation.operationLogin
self.authController = ASAuthorizationController(authorizationRequests: [request])
self.authController?.delegate = self
self.authController?.presentationContextProvider = self
self.authController?.performRequests()
} else {
print("failed to perform authorization")
}
} …Run Code Online (Sandbox Code Playgroud) 我有一个 UILabel,我想在这个标签中显示一些文本。我想将标签宽度最多增加设备全屏的 70%。如果该标签的文本长度不适合这 70% 的大小,则标签会自动转到与文本长度一样长的下一行。每次标签长度越过主屏幕的 70% 宽度时,线条也会中断。我已经尝试了几种方法但无法解决。请帮我解决这个问题。
提前致谢;
在 UIKit 中,我使用下面的代码来呈现一个具有演示风格crossDissolve 的模态视图控制器
controller.modalTransitionStyle = .crossDissolve
controller.modalPresentationStyle = .overFullScreen
UIApplication.topViewController()?.present(controller, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
但是我如何在 swiftUI 中实现这一点呢?