The configured identifier format is unknown.

Asked 2 years ago, Updated 2 years ago, 48 views

The code below
https://github.com/firebase/quickstart-ios/blob/d60148bc34847da1f80358052bd5bdb1cb6b2597/authentication/AuthenticationExampleSwift/PasswordlessViewController.swift#L65-L71
I don't know what format showSpinner and hideSpinner are configured in .
Is it a property, a method, or something else...
I think the identifier was set by the writer.

 iflet email=self.emailField.text{
    showSpinner {
        // [START signin_emaillink]
        Auth.auth().signIn(withEmail:email,link:self.link){(user,error)in
            // [START_EXCLUDE]
            self.hideSpinner{
                iflet error = error {
                    self.showMessagePrompt(error.localizedDescription)
                        return
                }
                self.navigationController!.popViewController(animated:true)
            }
            // [END_EXCLUDE]
        }
        // [END signin_emaillink]
    }
} else{
    self.showMessagePrompt("Email can't be empty")
}

swift

2022-09-30 21:43

1 Answers

I'm not sure if the "Writer set identifier" would be any particular situation, but it's a that uses the UIViewController extension method written in Objective-C from Swift.

BridgingHeader.h

// (comment abbreviated)

# import "UIViewController + Alerts.h"

UIViewController+Alerts.h

// (omitted)

/*! @fn showSpinner
 @ brief Shows the please wait spinner.
 @param completion Called after the spinner has been hidden.*/
- (void) showSpinner: (nullable void(^)(void)) completion;

/*! @fn hideSpinner
 @ brief Hides the please wait spinner.
 @param completion Called after the spinner has been hidden.*/
- (void) hideSpinner: (nullable void(^)(void)) completion;

// (omitted)

UIViewController+Alerts.m

// (omitted)

- (void) showSpinner: (nullable void(^)(void)) completion {
  if([self supportsAlertController]) {
    self showModernSpinner: completion;
  } else{
    self show IOS 7 Spinner: completion;
  }
}

// (omitted)

- (void) hideSpinner: (nullable void(^)(void)) completion {
  if([self supportsAlertController]) {
    selfhideModernSpinner: completion;
  } else{
    self hideIOS 7 Spinner: completion;
  }
}

// (omitted)

So it's not just a header, it's a method definition."Configured identifier" is a term that is not often heard in the field of programming, but it is not specifically configured.

Rewrite to Swift style, and you'll find another file in the project.

extension UIViewController {
    //...

    func showSpinner(_completion:()->Void?){
        //...
    }

    //...

    US>funchideSpinner(_completion:()->Void?){
        //...
    }

    //...
}

This extension is defined, so it feels like you are using the method in it.

How each method works (for example, completion is always called) is not known until you follow the Objective-C code.


2022-09-30 21:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.