Sending text messages using Twilio from an iOS app can be dangerous due to the need to store Twilio credentials in the app. However, by running Swift on the server, this risk is eliminated. The code uses Alamofire to make an HTTP request to Twilio's REST API and authenticate with Twilio account SID and auth token stored as environment variables. A Swift package is created using the Swift Package Manager to handle dependencies, including Alamofire. To send a text message, a Twilio phone number must be purchased and the account SID and auth token used in the code. The code is run using `swift build && ./.build/debug/SwiftSMS`, allowing server-side Swift to send text messages with Twilio.