In this article, we’re going to learn about
enumerations in Swift or as they’re more commonly known, enums.
An enumeration defines a common type for a group of related values and enables you to work with those values in a type-safe way within your code — swift.org
Enumerations are used to model a finite dataset and found commonly in different programming languages. In Swift its history can be traced back to C language but
enumerations in Swift are a lot more flexible.
Swift offers multiple ways to model data to be used in a program. We can use object and collections to do that. But there is certain kinds of data where normal
collections don’t quite suffice the need. …
Even companies like Facebook and Google have been building their businesses upon some form of Graph database for decades.
Graph databases are powering numerous businesses around the globe and in this article, we will discuss modern-day Graph databases and what led to the evolution of databases. …
In a previous article — Build iOS-ready machine learning models using Create ML—we learned how to create and train our own Core ML model using Xcode.
Then, we learned how to fine-tune these custom models to provide accurate results. For that, check out the following tutorial: Create ML — Increasing ML model accuracy.
In this tutorial, we’ll use the model that we created in the previous two tutorials and create an application that will use image classification to classify the food items according to 20 classes that were used for training the data.
The ML model that we have created is a multi-class image classifier. We’ll feed an input image to our model, and the output will be the class to which that image belongs. For example, if we expose an apple to the model, it should correctly predict that it belongs to the class “apple”. …
Apple rocked the iOS world with WWDC 2019 when it announced its new state-driven, declarative UI framework. It is a change for the better and in this article we will introduce the framework and touch up on some of its new component primitives.
Before we get started, many of you might be under the dilemma whether to start learning
SwiftUI or broaden
UIKit’s knowledge. The answer to that question is simple since many current apps still need to support OS versions below iOS13, it is advised to continue growing your horizons on both the fronts.
iOS13 is the minimum deployment version for SwiftUI. …
In my previous tutorial—Build iOS-ready machine learning models using Create ML—we discussed how to use our own data and categories to train custom ML models ready for iOS. We used our training dataset (link) to achieve training and validation accuracy of 91% and 89%, respectively.
In this article, we’ll discuss how to increase these accuracy values, how to validate the model using a validation set, and examine overfitting and find a solution to this common machine learning problem.
Since we used only one dataset—i.e. the training dataset—to train the model, Create ML didn’t use all the images in the set to train, since it also requires a set of images for validation (or in other words, training on data the model hasn’t already seen). …
A sequence is a list of values that you can step through one at a time.
Swift sequences are one of the most fundamental concepts present in the language and we can use it to create custom collection types. The biggest advantage of using sequences as foundation blocks for custom collection types is that we get direct access to highly optimised versions of a bunch of algorithms right out of the box. Since Sequences forms a core foundation block while creating custom collection types, it becomes really important to know Sequences in detail.
In this article we will dive deeper inside the
Sequence protocol, discover
UnfoldSequence and use it to create our
Sequence types with minimal code. …
While discussing generics in Swift, we learned how to make structs, enums, and classes generic.
We discovered how to pass in abstracted type information at the compile time, leaving it up to the compiler to carry that information from compile time to run time. We used protocols to declare the capability of those types.
But what about protocols? How do we make protocols generic and what are the advantages of doing so?
In this article, we will discuss generic protocols or associated types.
Protocols might come across to you as something that is already generic as any type can conform to a protocol, but what about the internals of the protocol? …
Most of the time, when we start working with machine learning, we tend to use models that are readily available online so that we don’t have to spend time and effort creating and training them on our own. But this comes at a cost, as these models don’t usually fit our requirements exactly as expected. Fortunately, Apple has provided Create ML to address those issues, and in this article we’ll learn how to use our own data and categories to train our models.
We can use Create ML to train models to perform tasks like recognizing images, extracting meaning from text, or finding relationships between numerical values. …
Create efficient and reusable abstractions
Generics are a key feature in Swift, which combined with protocols gives performance, flexibility, and concise, comprehensible compile errors if we make a mistake while using them in code.
In this article we will discuss the generics system, use of protocols in generics constraints, @inlinable and more.
We have all worked with simple array examples like the following code a number of times:
var names = [“Eli”, “Adam”, “Simon”]
The code above is exact equivalent of using a variable with explicit type annotation as follows:
var names : [String] = [“Eli”, “Adam”, “Simon”]
and this in turn is a short form for the full generic type…
In this article, we’ll discuss some foundational concepts in machine learning (ML) that are particularly important for mobile developers interested in working with ML.
Mobile devices provide four different input sources that can be used for machine learning. These sources are: