English 中文(简体)
签字人
原标题:SignInWithAppleButton occupies entire view space and ignores the frame sizing
  • 时间:2023-09-30 04:51:27
  •  标签:
  • swiftui

添加一个本地的快速倡议“与果树相配”纽.。 纽芬兰无视框架的规模,并全心全意。

另外,我尝试了<代码>固定,但结果大致相同。 我使用的是Xcode 15和macOS 14.0。

Not sure if this is a bug in macOS, SwiftUI: Cannot change height of "Sign In with Apple" button on macOS

SignInWithAppleButton(
    .continue,
    onRequest: { request in
        request.requestedScopes = [.email]
    },
    onCompletion: { result in
        switch result {
        case let .success(authorization):
            guard
                let appleIDCredentials = authorization
                    .credential as? ASAuthorizationAppleIDCredential
            else { return }

            print(
                ">>> DEBUG: SignInWithAppleButton Auth Credential Ready - ",
                appleIDCredentials)
        case let .failure(error):
            print(">>> DEBUG: SignInWithAppleButton Auth Failed - ", error)
        }
    })
.border(Color.red)
.frame(height: 30.0)

enter image description here enter image description here

问题回答

信用社

他发现与农业企业部进行简单的工作。 采用clipShape似乎控制了该层。

You ll also need to set the width because after applying the clipShape, it will still fill the width.

SignInWithAppleButton(
    .continue,
    onRequest: { request in
        request.requestedScopes = [.email]
    },
    onCompletion: { result in
        // Whatever...
    }
)
.clipShape(RoundedRectangle(cornerRadius: 4, style: .continuous)) // Workaround here...
.frame(width: 300) // ...and here




相关问题
SwiftUI: How do I position a button x points above a sheet?

I am trying to recreate a Maps-style UI with a persistent bottom sheet and controls fixed above. Apple Maps UI with controls above ☝️ Example here, the "Look Around" binoculars button and ...

How to access own window within SwiftUI view?

The goal is to have easy access to hosting window at any level of SwiftUI view hierarchy. The purpose might be different - close the window, resign first responder, replace root view or ...

热门标签