10.7. Posting Data with AlamoFire: POST
http://apis.sakibnm.space:8888/contacts/text/add
Fetching the user inputs and creating a new Contact object
//
// ViewController.swift
// App10
//
// Created by Sakib Miazi on 5/25/23.
//
import UIKit
import Alamofire
class ViewController: UIViewController {
//codes omitted...
override func viewDidLoad() {
super.viewDidLoad()
//codes omitted...
//MARK: add action to Add Contact button...
mainScreen.buttonAdd.addTarget(self, action: #selector(onButtonAddTapped), for: .touchUpInside)
}
//MARK: on Add Contact button tapped...
@objc func onButtonAddTapped(){
}
//MARK: add a new contact call: add endpoint...
func addANewContact(contact: Contact){
}
}
Making the API call for the endpoint 'add.'

Previous10.6. Fetching Data with AlamoFire: GETNext10.8. Fetching Data with AlamoFire: 'details' endpoint
Last updated