[Solved] Facebook Objective C to Swift 4 [closed]

Seems like you are looking for this func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) return true } And func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String!, … Read more

[Solved] iOS || Swift || how to convert date response String to expeced timestamp

Use DateFormatter let dateString = “2022-8-01T03:23:35.430+0000” let dateFormatter = DateFormatter() dateFormatter.dateFormat = “yyyy-MM-dd’T’HH:mm:ss.SSSX” let date = dateFormatter.date(from: dateString) print(date) // Date object /// Date to String let format = “EEE, d MMM YYYY, h:ss a” // format you need as a String let formatter = DateFormatter() formatter.dateFormat = format //By default AM/PM symbols are uppercased … Read more

[Solved] How to parse a String like “14px” to get Int value 14 in Swift [duplicate]

If string always come with just px at last you can subscript it and ignore the last 2 characters. let str = “14px” var numStr = str.substring(to: str.index(name.endIndex, offsetBy: -2)) print(numStr) // “14” //Now you can convert “14” to Int print(Int(numStr)) Or print(Int(String(str.characters.dropLast(2)))) solved How to parse a String like “14px” to get Int value … Read more

[Solved] Can’t call a function in viewDidLoad [closed]

Your addMarker has an extra bracket. func addMarker(place:EClass) { guard let coordinates = place.location else { return } self.destination = coordinates // clear current marker marker.map = nil marker.position = coordinates marker.title = place.name marker.map = mapView mapView.selectedMarker = marker } 7 solved Can’t call a function in viewDidLoad [closed]

[Solved] Is there a Swift equivalent for this code? [closed]

The equivalent Swift code would be as follows. let scrollPoint = CGPoint(x: 0, y: textField.frame.origin.y) scrollView.setContentOffset(scrollPoint, animated: true) There are lots of good resources for learning Swift. The Apple book on Swift is free and quite good. solved Is there a Swift equivalent for this code? [closed]

[Solved] I do not understand what this code does(the code is about segues)

That’s not the best segue code. Here’s how I’d code it (for the record, there are several ways to code this): override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == “[segue name here]” { if let nextVC = segue.destination as? CreateTasksViewController { nextVC.tasksVC = self } } } The code you posted has … Read more

[Solved] How to format address lines in Swift?

The address is expressed through the CLPlacemark postalAddress property. let address = placemark.postalAddress That line won’t compile unless you also import Contacts at the top of your file. Okay, so now you are in the Contacts world! What you have is a CNPostalAddress. You can ask the CNPostalAddress for its street, city, state, and other … Read more

[Solved] Nested Dictionary in my swift application

You can try if let sprites = pokemonDictionary[“sprites”] as? [String:Any] { print(sprites) if let backImgUrl = sprites[“back_default”] as? String { print(backImgUrl) } } Also you should run function named CallUrl in a thread other than the main , as Data(contentsOf:) runs synchronously and blocks the main thread 1 solved Nested Dictionary in my swift application

[Solved] Switch between dark and light mode (Swift) [closed]

Thanks to your help, I have now managed to do it. @IBAction func system(_ sender: Any) { let window = UIApplication.shared.keyWindow window?.overrideUserInterfaceStyle = .unspecified } @IBAction func dunkel(_ sender: Any) { let window = UIApplication.shared.keyWindow window?.overrideUserInterfaceStyle = .dark } @IBAction func hell(_ sender: Any) { let window = UIApplication.shared.keyWindow window?.overrideUserInterfaceStyle = .light } solved Switch … Read more