Open source ios apps written in swift

21 Amazing Open Source iOS Apps Written in Swift

This is “amazing” series of open source projects.

Swift is a general-purpose programming language developed by Apple Inc. for iOS, OS X, watchOS and tvOS. Currently it is the most popular open source programming language on Github.

Mybridge AI evaluates the quality of content and ranks the best articles for professionals. In this observation, we’ve compared nearly 900 open source apps written in Swift and picked the top 21 projects.

900 -> 21. Only 2.3% chance to be included in the list.

Open source projects can be useful for beginners to read the source code and advanced programmers to work on top of the existing projects. This list is competitive and carefully includes the best iOS projects that can help you code more productively in Swift. (Note that libraries are not included).

If you’re looking for the following, click below:

  • 23 Amazing Swift UI Libraries for the Past Year (v.2019): Here
  • 20 Amazing Swift Projects (v.2019): Here
  • Amazing Swift Libraries of 2017 (avg. 3,717 ⭐️): Here
  • Amazing Swift UI Libraries (v.2017, avg. 4,010 ⭐️): Here
  • Amazing Open Source Android Apps (avg. 3874 ⭐️): Here

<Recommended Learning>

No 1) Beginner

iOS 11 & Swift 4 — The Complete iOS App Development Bootcamp

[15,216 recommends, 4.8/5 stars]

No 2) Machine Learning

Complete iOS 11 Machine Learning Masterclass

[1,081 recommends, 4.7/5 stars]

Written by Rudrank Riyam.

In your iOS development learning journey, you want to understand and use the best practices while writing code. There are many open source apps on GitHub for you to take a look at. These open source projects demonstrate working with Clean Architecture, writing good tests for your native iOS app, and knowing how and what to test. This post discusses some open-source iOS apps that you can take inspiration from to learn better development practices, such as:

  • Clean Architecture
  • Dependency injection
  • Modularizing the app

You can find the source code of each project by clicking on the link in the header. Every project contains apps built with Xcode and contains a sample codemagic.yaml for you to run on Codemagic.

Upcoming Movies App by Alonso Alvarez

This iOS movies app is written in Swift 5 using the TMDB API, and it demonstrates:

  • Clean Architecture
  • Dependency injection
  • The Model-View-ViewModel (MVVM) pattern
  • Working with coordinators

Upcoming movies screen containing the list of movies.

The iOS Swift project also uses fastlane to run the unit tests and SwiftLint scans to enforce Swift’s style and conventions.

Going through this project can also help you understand how to use third-party libraries like Kingfisher for downloading and caching the images of the movies.

Then, KeychainSwift is used to securely save the signed-in user’s session ID and account ID in Keychain.

The GitHub project contains a sample codemagic.yaml file that you can use for building this open-source iOS project and running tests with Codemagic. If you’re not registered yet, sign up here:

Sign up

Clean Architecture for SwiftUI & Combine by Alexey Naumov

This demo project showcases how you can set up a native iOS/macOS app using the SwiftUI framework with Clean Architecture. The app uses the REST Countries API to show the list of countries and details.

Openn source iOS app example that contains a list of countries

This project can help you understand how to:

  • Decouple the presentation, business logic, and data access layers
  • Have full test coverage, including the UI tests
  • Use a Redux-like centralized state container as the single source of truth
  • Persist data with Core Data
  • Manage dependency injection in a native SwiftUI app
  • Perform programmatic navigation and push notifications with deep linking
  • Create a simple yet flexible networking layer built on generics

Finally, this app is designed for scalability. You can use it as a reference for building large production apps.

If you want to learn more about the author’s thought process, you can read their article on Clean Architecture for SwiftUI.

The GitHub project contains a sample codemagic.yaml file that you can use for building this open-source iOS project and running tests with Codemagic.

TVShows iOS by Jeans Ruiz

This open-source iOS Swift project is built with RxSwift using the TMDB API. It is written using Swift 5 and uses Tuist to generate the workspace.

Breaking Bad details screen that is shown after searching for TV shows.

This project can help you learn how to use:

  • RxSwift, RxDataSources
  • Clean and Modular Architecture
  • The coordinator pattern
  • The MVVM pattern
  • Dependency injection

Apart from working with different third-party dependencies, this open-source iOS project introduces you to Tuist, a command-line tool that helps you generate, maintain, and interact with Xcode projects. The project and workspace are not committed to a Git repository. Instead, they are generated locally on your machine, which means no more Git conflicts!

The GitHub project contains a sample codemagic.yaml file that you can use to generate the project using Tuist and build it.

Template iOS App using Clean Architecture and MVVM by Oleh

This is a template iOS project implemented with Clean Layered Architecture and MVVM. You can use it in your project by replacing the “Movie” item.

The architectural concepts used here are:

  • Clean Architecture
  • MVVM pattern
  • Data binding using Observable without third-party libraries
  • Dependency injection
  • Flow coordinator
  • Data Transfer Object (DTO)
  • Response data caching
  • ViewController lifecycle behavior
  • SwiftUI and UIKit view implementations that reuse the same ViewModel
  • Error handling examples: in ViewModel and networking
  • CI pipeline (Codemagic + fastlane)

Open source iOS app example that shows clean architecture with MVVM pattern

This iOS Swift project also provides a great demonstration of how to have a good iOS project folder structure.

It is accompanied by an article on how architectural patterns such as MVVM and Clean Architecture can be applied in an iOS app. Clean Architecture and MVVM on iOS.

The GitHub project contains a sample codemagic.yaml file that you can use for running tests with Codemagic.

Modular Architecture on iOS by Oleh

This is a template iOS project implemented with Modular Architecture. You can use it in your project by replacing the “Movie” item.

As your iOS project grows, it gets difficult to maintain and manage it with several developers. The idea of modularization is that you break or split the app into different modules, like networking, authentication, and tracking, or even isolate large features in their own modules.

This means that if you are working on a large feature for an iOS project, you can work on it independently without building the whole app. For example, Spotify’s iOS app is highly modularized and has more than 400 independent modules!

Open source iOS app example that shows module dependencies

The accompanying article explains how the monolith OLX app was split into 12 modules. Modular Architecture in iOS.

The GitHub project contains a sample codemagic.yaml file that you can use for running tests using fastlane.

Conclusion

While you may or may not use the design patterns utilized in these open-source iOS projects, separating the UI, business logic, and data layers is a great practice in the long run.

We hope the projects mentioned in this article will help you learn more about Clean Architecture, modularizing your codebase as it grows bigger, and working with dependency injection. If you have any suggestions or feedback, join our Slack community or mention @codemagicio on Twitter!

Open Source iOS Apps Written in Swift

Swift is a general-purpose programming language developed by Apple Inc. for iOS, OS X, watchOS and tvOS. Currently it is the most popular open source programming language on Github.

Open source projects can be useful for beginners to read the source code and advanced programmers to work on top of the existing projects. This list is competitive and carefully includes the best iOS projects that can help you code more productively in Swift.

[Official] Firefox iOS app built in Swift (Github Stars: 5,906).

[Official] WordPress for iOS written in Swift (Github Stars: 1,225).

Once suspended, devfan will not be able to comment or publish posts until their suspension is removed.

Note:

Once unsuspended, devfan will be able to comment and publish posts again.

Note:

Once unpublished, all posts by devfan will become hidden and only accessible to themselves.

If devfan is not suspended, they can still re-publish their posts from their dashboard.

Note:

Once unpublished, this post will become invisible to the public and only accessible to Tony Larry.

They can still re-publish the post if they are not suspended.

Thanks for keeping DEV Community 👩‍💻👨‍💻 safe. Here is what you can do to flag devfan:

Make all posts by devfan less visible

devfan consistently posts content that violates DEV Community 👩‍💻👨‍💻’s code of conduct because it is harassing, offensive or spammy.

Report other inappropriate conduct

Unflagging devfan will restore default visibility to their posts.

Modern

Swift is the result of the latest research on programming languages, combined with decades of experience building Apple platforms. Named parameters are expressed in a clean syntax that makes APIs in Swift even easier to read and maintain. Even better, you don’t even need to type semi-colons. Inferred types make code cleaner and less prone to mistakes, while modules eliminate headers and provide namespaces. To best support international languages and emoji, Strings are Unicode-correct and use a UTF-8 based encoding to optimize performance for a wide-variety of use cases. Memory is managed automatically using tight, deterministic reference counting, keeping memory usage to a minimum without the overhead of garbage collection. You can even write concurrent code with simple, built-in keywords that define asynchronous behavior, making your code more readable and less error-prone.

struct

Player {

var

name:

String

var

highScore:

Int

=

0

var

history: [

Int

] = []

init

(

_

name:

String

) {

self

.

name

= name }}

var

player =

Player

(

"Tomas"

)

Declare new types with modern, straightforward syntax. Provide default values for instance properties and define custom initializers.

extension

Player

{

mutating func

updateScore(_ newScore:

Int

) {

history

.

append

(newScore)

if

highScore

< newScore {

print

(

"

(

newScore

)! A new high score for

(

name

)! 🎉"

)

highScore

= newScore } }}

player

.

updateScore

(

50

)

Add functionality to existing types using extensions, and cut down on boilerplate with custom string interpolations.

extension

Player

:

Codable

,

Equatable

{}

import

Foundation

let

encoder =

JSONEncoder

()

try

encoder

.

encode

(

player

)

print

(

player

)

Quickly extend your custom types to take advantage of powerful language features, such as automatic JSON encoding and decoding.

let

players =

getPlayers

()

let

ranked =

players

.

sorted

(by: { player1, player2

in

player1.

highScore

> player2.

highScore

})

let

rankedNames =

ranked

.

map

{ $0.

name

}

Perform powerful custom transformations using streamlined closures.

These forward-thinking concepts result in a language that’s fun and easy to use.

Swift has many other features to make your code more expressive:

  • Generics that are powerful and simple to use
  • Protocol extensions that make writing generic code even easier
  • First class functions and a lightweight closure syntax
  • Fast and concise iteration over a range or collection
  • Tuples and multiple return values
  • Structs that support methods, extensions, and protocols
  • Enums can have payloads and support pattern matching
  • Functional programming patterns, e.g., map and filter
  • Built-in error handling using

    try

    /

    catch

    /

    throw

Designed for safety

Swift eliminates entire classes of unsafe code. Variables are always initialized before use, arrays and integers are checked for overflow, memory is automatically managed, and enforcement of exclusive access to memory guards against many programming mistakes. Syntax is tuned to make it easy to define your intent — for example, simple three-character keywords define a variable ( var ) or constant ( let ). And Swift heavily leverages value types, especially for commonly used types like Arrays and Dictionaries. This means that when you make a copy of something with that type, you know it won’t be modified elsewhere.

Another safety feature is that by default Swift objects can never be nil. In fact, the Swift compiler will stop you from trying to make or use a nil object with a compile-time error. This makes writing code much cleaner and safer, and prevents a huge category of runtime crashes in your apps. However, there are cases where nil is valid and appropriate. For these situations Swift has an innovative feature known as optionals. An optional may contain nil, but Swift syntax forces you to safely deal with it using the ? syntax to indicate to the compiler you understand the behavior and will handle it safely.

extension

Collection

where

Element

==

Player

{

func

highestScoringPlayer() ->

Player

? {

return self

.

max

(by: { $0.

highScore

< $1.

highScore

}) }}

Use optionals when you might have an instance to return from a function, or you might not.

if let

bestPlayer =

players

.

highestScoringPlayer

() { recordHolder =

""" The record holder is (bestPlayer.

name

), with a high score of (bestPlayer.

highScore

)! """

}

else

{ recordHolder =

"No games have been played yet."

}

print

(recordHolder)

let

highestScore =

players

.

highestScoringPlayer

()?.

highScore

??

0

Features such as optional binding, optional chaining, and nil coalescing let you work safely and efficiently with optional values.

Fast and powerful

From its earliest conception, Swift was built to be fast. Using the incredibly high-performance LLVM compiler technology, Swift code is transformed into optimized machine code that gets the most out of modern hardware. The syntax and standard library have also been tuned to make the most obvious way to write your code also perform the best whether it runs in the watch on your wrist or across a cluster of servers.

Swift is a successor to both the C and Objective-C languages. It includes low-level primitives such as types, flow control, and operators. It also provides object-oriented features such as classes, protocols, and generics, giving Cocoa and Cocoa Touch developers the performance and power they demand.

Great first language

Swift can open doors to the world of coding. In fact, it was designed to be anyone’s first programming language, whether you’re still in school or exploring new career paths. For educators, Apple created free curriculum to teach Swift both in and out of the classroom. First-time coders can download Swift Playgrounds—an app for iPad that makes getting started with Swift code interactive and fun.

Aspiring app developers can access free courses to learn to build their first apps in Xcode. And Apple Stores around the world host Today at Apple Coding & Apps sessions where you can get practical experience with Swift code.

Learn more about Swift education resources from Apple

Open source

Swift is developed in the open at Swift.org, with source code, a bug tracker, forums, and regular development builds available for everyone. This broad community of developers, both inside Apple as well as hundreds of outside contributors, work together to make Swift even more amazing. There is an even broader range of blogs, podcasts, conferences and meetups where developers in the community share their experiences of how to realize the great potential of Swift.

Cross platform

Swift already supports all Apple platforms and Linux, with community members actively working to port to even more platforms. With SourceKit-LSP, the community is also working to integrate Swift support into a wide-variety of developer tools. We’re excited to see more ways in which Swift makes software safer and faster, while also making programming more fun.

Swift for server

While Swift powers many new apps on Apple platforms, it’s also being used for a new class of modern server applications. Swift is perfect for use in server apps that need runtime safety, compiled performance and a small memory footprint. To steer the direction of Swift for developing and deploying server applications, the community formed the Swift Server work group. The first product of this effort was SwiftNIO, a cross-platform asynchronous event-driven network application framework for high performance protocol servers and clients. It serves as the foundation for building additional server-oriented tools and technologies, including logging, metrics and database drivers which are all in active development.

To learn more about the open source Swift community and the Swift Server work group, visit Swift.org

Playgrounds and Read-Eval-Print-Loop (REPL)

Much like Swift Playgrounds for iPad, playgrounds in Xcode make writing Swift code incredibly simple and fun. Type a line of code and the result appears immediately. You can then Quick Look the result from the side of your code, or pin that result directly below. The result view can display graphics, lists of results, or graphs of a value over time. You can open the Timeline Assistant to watch a complex view evolve and animate, great for experimenting with new UI code, or to play an animated SpriteKit scene as you code it. When you’ve perfected your code in the playground, simply move that code into your project. Swift is also interactive when you use it in Terminal or within Xcode’s LLDB debugging console. Use Swift syntax to evaluate and interact with your running app, or write new code to see how it works in a script-like environment.

Package manager

Swift Package Manager is a single cross-platform tool for building, running, testing and packaging your Swift libraries and executables. Swift packages are the best way to distribute libraries and source code to the Swift community. Configuration of packages is written in Swift itself, making it easy to configure targets, declare products and manage package dependencies. Swift packages can also include custom commands that help build your projects and provide additional tooling. Swift Package Manager itself is actually built with Swift and included in the Swift open source project as a package.

Objective-C interoperability

You can create an entirely new application with Swift today, or begin using Swift code to implement new features and functionality in your app. Swift code co-exists along side your existing Objective-C files in the same project, with full access to your Objective-C API, making it easy to adopt.

Written by Jane