Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free

"swift" posts

  • By Aaron Alaniz
    Deploy your own video collaboration app in five minutes or less Deploy your own video collaboration app in 5 minutes or less

    Today we are excited to announce that we are open sourcing three video collaboration applications, one for iOS, one for Android, and a ReactJS one for the Web. Whether you are building a healthcare, education, or general video collaboration solution, these apps can accelerate development by providing you with a fully functioning video app that can be deployed to the cloud in minutes. In addition, they provide a canonical reference for developers building out their communication solutions by showcasing the Programmable Video capabilities. These applications are available today on Github under the Apache 2.0 license:

    At Twilio we strive to build a reliable, extensible platform so that our customers can build high quality communication experiences in their applications. Our Video SDKs provide the API building blocks for mobile and web developers to create custom communications experiences in their apps. We believe …

    Read More
  • By Lizzie Siegle
    Call Twilio Functions from iOS in Swift callfuncsfromios.jpg

    There are many things you can do from iOS but sometimes, for example, you may need to make a web request to fetch information. With Twilio Functions you can focus on writing the code that matters without having to maintain a server. This tutorial will show you how to set up a Twilio Function that returns a Pokemon joke or two and then call that Function from an iOS application.



    Before you get started, you'll need

    • a Twilio account to create a Twilio Function 
    • Xcode installed to make a rudimentary iOS app to call the Function
    • A little JavaScript (for Twilio Functions) and Swift knowledge

    Make a Twilio Function 

    The Twilio Function in this tutorial will return a simple hard-coded Pikachu joke. To make that Function, from your Functions page, click the red "+" button to make a new Function.redplusfunc.png

    If this is your first Function, you'll click …

    Read More
  • By Aymen Naim
    Announcing General Availability of Twilio’s Programmable Voice Mobile SDKs 3.0 Programmable Voice iOS SDK

    With Twilio’s Programmable Voice SDKs for iOS and Android, you can easily build engaging and high quality voice calling experiences into your Apps. Whether it is calling a phone number (PSTN), another App user (VoIP), or your contact center, you can bring a contextual and secure calling experience to your users directly from your App.

    We are thrilled to announce that our latest version of Programmable Voice Mobile SDKs, 3.0, is now generally available. With 3.0, you can make your customer call experiences even more engaging: with improved audio quality, increased efficiency, and contextual calling. This release includes features such as support for Opus codec, call control functions, and custom parameters.

    We will walk you through the advantages of using Mobile VoIP with some common use cases, what new features rolled out with 3.0, and explain how to get started and/or migrate to Twilio Programmable Voice SDKs 3.0.

    Eager to …

    Read More
  • By Lizzie Siegle
    Generate Songs with Markov Models using Server-Side Swift, Perfect, and Twilio SMS generate-music-with-swift-twilio

    I like music and coding and one way to make music with code is by predicting words and generating a new song. You can do this with Markov models, as introduced in this last Twilio blog post. Now let's learn how to train a model on a .txt file to generate a song and then generate another song or text via Twilio SMS with server-side Swift and Perfect.

    Set Up

    To code along with this post you should have the following:

    1. A Twilio account to buy a phone number
    2. ngrok, a tool for putting the app running on your local machine on the web
    3. Xcode

    First, make a new Single View project in Xcode and run pod init on the command line in the directory where your Xcode project exists to create a Podfile in order to install the Markov Model library via CocoaPods, as further …

    Read More
  • By Lizzie Siegle
    Receive and Respond to Text Messages with Server-Side Swift, Perfect, and Twilio perfecttwilioswift.jpg

    Perfect is a versatile open source server-side Swift framework and toolset that makes it easy for developers to quickly create server- and client-side apps. Let's see how easy it is to send SMS with Twilio and Perfect.


    To follow along with this post we'll need

    Install Perfect using the Swift Package Manager. Create a new project directory called PerfectSMS and then on the command line in your project directory, run

    swift package init --type executable
    swift package generate-xcodeproj

    This generates a package with the same name as your current directory.

    1. Package.swift at the top-level of your project contains your package description and your package’s dependencies.
    2. Sources/ is home to all your Swift source files, including main.swift, which will be the entry point for your project. It currently prints hello, world to the Terminal.
    3. Tests/ will contain unit tests you can write …
    Read More
  • By Barney Waiganjo
    How to Add Keyframe Animations to iOS Apps in Swift 4 OibP_MhVytCwAouP1CsLwizQPWxk1cSLY46NM69XDz2GyYJ3ddBQOBfAzWu-i3dU-CAjYUO2AbG5dTSJL6ZjW9t2cVkD05fO8c4tbb5kTuLdYoTZi9r8NQy5V1svA1SzWwtm6Q81

    In the beautiful world of modern iOS applications, not much stands out more than well applied animations and transitions. They capture the user’s attention and set your app apart from the competition. If you’ve ever wished to add cool animations to your current or future projects but felt it was too challenging, this article is purposely meant to change your mind.

    Tools You’ll Need

    To be able to follow along with this tutorial, there are a couple of prerequisites before we start. You will need:

    • A Mac running the latest point release of macOS X Sierra or later.
    • Xcode 8 or later.
    • Basic knowledge of the Swift 4 language and Auto Layout.

    Getting Started

    Now that we have all that we’ll need, let’s find out what we’re going to be working on.
    I have already set up a small project for us to work on. You can download it …

    Read More
  • By Lizzie Siegle
    Intro to Markov Models with Swift Rick Roll Cover Image

    Did you know PageRank, the algorithm Google uses to determine the order of search results, is a type of Markov chain? I first learned about Markov chains and Markov models in my Speech Synthesis and Recognition elective and was amazed at how they are used in speech recognition, music generation, and modeling sequential data to predict the outcome of a basketball game (or almost any competition.)

    What are Markov Chains and Markov Models?

    The most basic type of Markov model is a Markov chain, a model whose next state is only selected based on its current state. Markov chains are used in genetics, finance, economics, game theory, and other fields. An example of one would be predicting tomorrow's weather by looking only at today's weather, not yesterday's.

    weather prediction with a ball gif

    Wikipedia defines a Markov model like so: 

    In probability theory, a Markov model is a stochastic model used to model randomly changing …

    Read More
  • By Lizzie Siegle
    Intro to Speech Recognition in Swift via FlyoverKit speechsiricombined.jpg

    One of my favorite computer science electives was Speech Synthesis and Recognition because Natural Language Processing and Computational Linguistics are becoming more widespread (look at Siri!). In this post we will add speech recognition to select famous landmarks with FlyoverKit in Swift. If you haven't seen part one of this multi-part series, check it out on the Twilio blog here.


    For this post you will need Xcode 10, a Mac, and a physical iOS device to test the speech recognition features. To follow along with this post make sure to clone the corresponding GitHub repo here as we'll be adding speech recognition capabilities to it. If you just want to make a simple speech recognition app in Swift, you can use the same code but just need to add a button to your ViewController. Name the button locButton, and create a label called placeLbl …

    Read More
  • By Barney Waiganjo
    Animating View Properties in Xcode with Swift 4 and Auto Layout eKnIEBdn-ZMTKBDw32Y26D3o572YaEi7krXp0OLWm_zuNoUtN-RvlBAPX81w-nJW2eBUiPZ3rTP6Ik5DQiN1yA4DZssOnsS3WYQkaCMV_l0CbgSSLCT5pq1_QhrZ_PwxJH0z7wv_

    One way to make your iOS applications more interactive is by adding awesome view animations. They always look cool and are surprisingly easy to accomplish. You’re in the right place if you would love to learn how to add fun animations to your next project.

    Tools You’ll Need

    To be able to follow along with this tutorial,  there are a couple of prerequisites before we start. You will need:

    • A Mac running the latest point release of macOS X Sierra or later.
    • Xcode 8 or later.
    • Basic knowledge of the Swift 4 language and Auto Layout.

    If you don’t have any of these, go ahead and get them now.

    Getting Started

    Now that we have what we’ll need, let’s get to work. I’ve already set up a small project for us to work on. You can download it here or if you prefer to check out the GitHub …

    Read More
  • By Sam Agnew
    Working with JSON in Swift Swift JSON

    Often developers need to deal with data in various different formats and JSON, short for JavaScript Object Notation, is one of the most popular choices. This is the syntax that the JavaScript language uses to denote objects.

    For this post, we are going to use the following modified JSON data from NASA's Astronomy Picture of the Day API to cover some basic examples of scenarios where you'd need to parse JSON. You will need to be running Swift 4.0 or greater. The following JSON is the example that we are going to be working with:

        "copyright": "Yin Hao",
        "date": "2018-10-30",
        "explanation": "Meteors have been shooting out from the constellation of Orion. This was expected, as October is the time of year for the Orionids Meteor Shower. Pictured here, over two dozen meteors were caught in successively added exposures last October over Wulan Hada …
    Read More
  • Newer
    Sign up and start building
    Not ready yet? Talk to an expert.