Search code examples
iosswiftswift-package-manager

Use of unresolved identifier 'AF' while using Almofire by Swift Package Manager


I am using Almofire through Swift Package Manager (SPM) and also imported it by import Alamofire. While I am trying to make a network request using AF, it gives me following error:

enter image description here


Solution

  • In your Swift Package Dependencies seems that you are using Alamofire 4.9.1 and, if i'm not wrong, AF namespace is used from Alamofire 5. So you can switch to Alamofire 5 or change

    AF.request("url..")...
    

    to

    Alamofire.request("url..")...