TwilioSwift

这是一个正在进行中的项目。目前只添加了所需的一些特定功能,并会随着时间的推移而扩展。

配置

通过在您的 Package.swift 文件中包含该软件包,将其导入到您的 Swift 项目中

.package(url: "https://github.com/iamjono/TwilioSwift.git", from: "0.0.1")

从 Twilio 控制台获取 Account SID 和 Authentication Token。

在您的可执行项目中,例如在您的 main.swift 中,设置 SID 和 Authentication Token

import TwilioSwift

TwilioConfig.accountSid = "{yourSID}"
TwilioConfig.authToken = "{yourToken}"

当前功能

发送 SMS

获得 Twilio 电话号码后,您现在可以发送 SMS 消息

let t = Twilio.sendSMS(
	from: "+{twilio_issued_number}", 
	to: "+{country_code}{phone_number}", 
	message: "Hello, World!"
	)
// Output the success/fail message
print(t)