SSL Pinning with swift using alamofire and url session. Alamofire version 4 is used for ssl pinning.
For some apps, the only endpoints we want to communicate with are those you trust and have certificates for (e.g. mobile banking applications). In that case, we need to do some handiwork to bring the correct behavior of Alamofire 4.
Follow the blog article for details implementation:
Blog