'Alamofire 5 with self-signed certificate

I'd like to bypass certificate validation using Alamofire 5 and Swift 4. I'm using Alamofire to connect to a server with a self-signed certificate. This is similar to this question Alamofire with a self-signed certificate / ServerTrustPolicy, but the answers are for previous Alamofire versions and it's not clear to me how to apply this approach to version 5. Does anyone know how to implement this in Alamofire 5?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source