I want to implement a login function on Twitter using Swifter.

Error message

The following error has occurred, can you tell me how to deal with it?

Cannot convert value of type 'String' to expected argument type 'URL'
Applicable source code

↓ AppDelegate.swift

import UIKit
import Firebase
import Swifter
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?
    func application (_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)->Bool {
        FirebaseApp.configure ()
        return true
    func application (_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:])->Bool {
        return Swifter.handleOpenURL (url, callbackURL: "Enter callback URL") // ← Entering a callback URL results in an error

I have implemented it according to this article.
[iOS] Login to Twitter with" Swifter "instead of TwitterKit

  • Answer # 1

    The URL to put in callbackURL

    callbackURL: URL (string: "swifter- {Consumer API key}: //")

    How about casting from String type to URL type?