Here's an example of how to make a GET request using Alamofire in Swift:
main.swift364 chars16 lines
This code sends a GET request to the JSONPlaceholder API and logs the response data to the console. The responseJSON
method tells Alamofire to parse the response data as JSON and returns a DataResponse<Any>
object. You can then check if there are any errors or extract the response data from the data
property of the response object.
gistlibby LogSnag