Authorization is one of the essential parts of any iOS application. Once a user is logged in, it’s your authorization scheme that will make sure users can’t interact with your app in ways they’re not allowed to. Without a robust authorization scheme, hackers could easily access sensitive user data and engage in other damaging activities such as scamming.
Thankfully, the widespread use and standardization of JWT (JSON Web Tokens) have made robust and cryptographically secure authorization more straightforward to achieve.
Building applications such as online games and real-time chat has never been more straightforward since the standardization of the WebSocket protocol in 2011. Before that, most app experiences were plagued with manual refreshes to access the latest data available. Remember F5? Since then, most apps use WebSockets in some form to update their user interface with new data as soon as it is available.
When coding iOS apps, we often create classes that manage a particular aspect of the application. For example, it’s common to develop “manager” classes that encapsulate methods for interacting with a specific application aspect. These aspects commonly include the REST API, WebSockets, database, caching, notifications, chat, etc. That is what’s called the Facade pattern, and it’s a prevalent way to organize code.
During the creation of a “manager” class, one of the first thoughts is: “How do I access these methods from somewhere else in my app’s code, such as inside a view controller?”. …
As of Swift 5 and Xcode 11, Swift Package Manager supports the iOS, macOS, and tvOS build system. This support has also been greatly improved in Xcode 12 with the addition of non-source files, including asset catalogs, storyboards and nibs, core data models, and localization folders. It also supports binary frameworks. It’s clear that it’s now viable for most iOS projects, and many dependencies such as Stream Chat have implemented support for it.
A quick Twitter poll showed that 46.5% of iOS developers still use CocoaPods as their primary dependency manager. Swift Package Manager follows just behind with 42.1%.
SwiftUI becomes more popular as it gets more capable with each iOS release. However, it may take some time until it’s a better option than UIKit to build complex user experiences such as chat and video calls. That doesn’t mean you need to stick with UIKit until all the SDKs you use support SwiftUI. In this tutorial, you’ll learn how easy it is to use SDKs built for UIKit in your SwiftUI app.
In this tutorial, I’ll use Stream Chat’s iOS SDK inside a SwiftUI app. It provides a fully-featured chat user interface in the form of a
Dependencies are vital for most iOS projects. They allow us to speed up development and not reinvent the wheel every time we need components such as networking, rendering, chat, calendar, and many others which can be common to different types of projects. It’s also an efficient way of deferring code maintenance to a company or open source community, since they’ll fix bugs, add new features, and update the code for you. Using dependencies, we’re able to focus our working hours on what sets our iOS app apart from the rest.
However, any seasoned iOS developer knows dependencies can often hold…
Most of the time, when building a chat application, it’s essential to have some level of control over what your users can share and say to each other.
In this tutorial, we’ll use Swift Lambda and Stream’s powerful chat API to build a content moderation system that can prevent users from sending unwanted content. In this case, we’ll filter out possible credit card data to prevent our users from sharing it with scammers. However, you can adapt it to other sensitive data or to block bad words.
Recently, Apple announced the Swift AWS Lambda Runtime. It’s now possible to write self-contained functions that run on AWS using the same Swift you use for iOS development. This not only lets you reuse the knowledge you already have of Swift, but also share code between the server and client.
However, everything is still a little bit complicated to set up. To help you get started faster, I built a starting point for writing an HTTP service in Swift, which does everything you need in a single script.
Did you know you can use Swift in the backend to build a chatbot and deploy it to AWS? We’ve recently published an Open Source project called Swift Lambda to make the process easier.
In this tutorial, we’ll use Swift Lambda to build a chatbot that can reply to user messages automatically using Stream’s powerful chat API.
The full code for this tutorial can be found in the Samples folder inside the Swift Lambda repository
After you’ve set up your iOS chat application and your Swift Lambda is up and running…