Tag: Swift

Crafting a Swift Package Plugin for App Data Protection

Protecting data and intellectual property is a common but challenging task in software development. No developer wishes their individual or team efforts to be unlawfully exploited by intruders or competitors. While iOS apps provide significant security — provided by Apple encryption and runtim...

Extensions in Swift

Extensions in Swift allow developers to add new functionality to existing classes and protocols without modifying their original implementation. For classes, extensions can include new methods, computed properties, and initializers, promoting code modularity. For protocols, extensions can provide de...

Open Closed Principle: O in SOLID — Practical with Swift

Open-closed Principle (OCP) is one of principle inside SOLID. OCP states that objects or entities should be open for extension but closed for modification. This means that when there is a new requirement in a system, we should not modify the existing code, but rather extend it. Thi...

Agile Architecture in Swift

Over the last decade, I have worked as an iOS developer in many different teams. While basically all teams described themselves as being agile, it never felt so. For most, “agile” had become a meaningless word, just describing a marketing term for a certification industry. But “...

Why Swift Is Better Than Java For Apple Developer?

Swift stands as a contemporary and robust programming language that Apple designed for crafting applications across its suite of devices. What sets Swift apart is its blend of performance and security, all wrapped in a clear and expressive syntax. Notably, it prioritizes safety through mechanisms li...

Advanced Swift Actors: Re-entrancy and Interleaving

Conceptually, they’re pretty simple: actors are reference-typed entities that enforce serial access to their methods and state. However, without understanding their nuances, it’s hard to know whether an actor is the right tool for the job or if you’re adding complexity. To help ...

Async/Await and MainActor Strategies

Pretty much every article that discusses Swift async/await will throw in a comment regarding @MainActor and how it can be used to ensure that any updates to the user interface will occur on the main thread. That’s all well and good… but just where should the @MainActor...

I Was Wrong About Taylor Swift

Here’s something you might not know about me and Sophie. We like Taylor Swift’s music. In particular, we appreciate her catchy tunes and creative videos. We especially love her song “The Man,” and even, “ME!” Many of Taylor’s songs are quirky, fun, ...

I Have A Bone To Pick With ‘Taylor Swift’

“Under capitalism, man exploits man. Under communism, it’s just the opposite.” — John Kenneth Galbraith Yes, I know, it’s sacrilegious. Criticize Taylor Swift? Is that even legal? Seriously, I’m not sure if in the state of Tennessee where she lives on...

Understanding Static Library vs Dynamic Library in iOS Swift

JARNBOY say “Hello everybody”, Welcome to share knowledge session for understand about Static Library and Dynamic Library for iOS developer Introduction When developing iOS applications using Swift, it’s crucial to understand the concept of librar...

3 Cool new features of Swift 5.9

01. Using if and switch as expressions Until Swift 5.9, the keywords if and switch could only be used as statements. This meant that it wasn’t possible to directly assign the result of an if or a switch to a variable or to pass it as an argument. ...

Swift Concurrency

The introduction of the concepts of Task, async/await, and Actors in Swift has revolutionized the development of code that utilizes multithreading and asynchronous execution. They offer a much simpler and efficient approach compared to the use of RunLoop, DispatchQueue, DispatchGroup, OperationQueue...

Using Sandwich To Understand Design Patterns in Swift

Design patterns are the blueprints that guide developers in creating clean, efficient, and maintainable code. The Builder design pattern is a creational pattern that allows for the construction of complex objects step by step. To make this pattern more accessible, let’s explore it using a real...

iOS Swift S.O.L.I.D. Principles

The SOLID principles were introduced by Robert C. Martin(a.k.a Uncle Bob) in his 2000 paper “Design Principles and Design Patterns.” These concepts were later built upon by Michael Feathers, who introduced us to the SOLID acronym. And in the last 20 years, these five principles...

Proxy Design Pattern in Swift

The Proxy design pattern is a structural pattern in which a surrogate object acts as a placeholder for another object. The Proxy pattern provides a way to control access to the original object by creating a proxy object that is responsible for communicating with the original object. This pattern can...

iOS Interview Guide: Escaping and Non-Escaping Closures in Swift

In your interviews, escaping and non-escaping closures demonstrate strong functions and closure skills and problem-solving abilities, enabling you to write efficient and concise code. Be ready to prepare these questions for your iOS interviews as these are the most common questions for interviews. ...

Preparing My App for Swift 6

Swift 6 won’t be released in 2023 anymore, that has been made clear by Doug Gregor from the Swift Language Workgroup. But did you know that Apple has already shipped parts of Swift 6 in 5.8? Yes, it’s true. Some parts of Swift that shipped with Xcode 14.3 a few weeks ago are&nb...

Swift Concurrency. Chapter 1: Async/await Basics.

As a small introduction, I would like to tell that this is my very first article on Medium and I’m very excited to start writing it  So, please don’t be too judging, however a reasonable feedback is super welcomed . This cycle of articles will be about Swift Structured Concurrenc...

Understanding Autorelease Pool in Swift for iOS Development

What is an Autorelease Pool? An autorelease pool is a construct used in Swift and Objective-C to manage the memory of objects that are no longer needed. It allows developers to delay the release of objects until a specific scope or function has been completed. Autorelease pools play a vital role ...

Parsing in Swift: a DTO-based Approach

Turning JSON into actual Swift types is something most apps have to deal with eventually. At the beginning of Swift, Apple was not opinionated about how we should approach that task. So people came up with a bunch of different libraries to do so. Some of them are quite esoteric. ...

Understanding Generics in Swift: A Comprehensive Guide

Generics are a powerful feature in the Swift programming language that allows you to write flexible and reusable code. Whether you’re a beginner or an experienced Swift developer, understanding and harnessing the potential of generics can significantly enhance your ability to write clean, effi...

iOS Interview Guide: Swift Properties

Swift properties are a core concept that you must be well-versed in. They form the basis for data management, encapsulation, and efficient code organization. In interviews, you can expect questions about property design, access control, computed properties, and more, making it a crucial topic to pre...

Transitioning from Completion Handlers to async/await with withContinuation in Swift

In the ever-evolving landscape of iOS app development, staying abreast of the latest advancements is vital for keeping applications up-to-date and maintaining optimal performance. With the introduction of Swift’s async/await and withContinuation methods, the process of mana...

Lifehack: Making Logging More Convenient in Swift

Usually, for debugging console output, we use the standard print function. For example, we might want to check whether a method is called or what data is saved somewhere. But there are many other possible use cases. Often, the number of these print statements becomes overwhelming and event...

OpenAI Swift package

Since ChatGPT came out, I’ve been wanting to spend some time playing around with OpenAI APIs. Finally, I found some free time to do just that. While attempting to integrate some of the functionality into a few projects, I thought it would be nice to create a library that supports all...

Difference between Function and Method in Swift

InSwift, both functions and methods are used to define reusable blocks of code, but they have some key differences: Methods vs Functions Function: A function is a standalone block of code that performs a specific task when called. Functions in Swift are not tied to any specific dat...

Swift Playgrounds: Learning iOS and macOS App Development with Fun

Swift Playgrounds is an app that makes learning to code fun and easy. It is available for both iPad and Mac, and it teaches you how to create apps using Swift, a powerful programming language developed by Apple. Swift Playgrounds lets you write real code in an interactive environment, where you can ...

Why I’m taking my family to Rio to see Taylor Swift

Well, Long Story Short … When my daughter Sabina was 12 years old, she was diagnosed with Osteosarcoma (bone cancer) in her right leg. One day during her chemotherapy treatment, we were hanging out in her hospital room and she asked me, “Daddy, if Taylor Swift ever goes on tou...

Will Taylor Swift lead her ‘Swifties’ to HELL? It seems Christian churches have taken a stand on their beliefs

While Taylor Swift will continue her ‘The Eras Tour’ until 2024, countless global Swifties eagerly anticipate their idol’s appearances on the magnificent stages. According to Newsnations, 2.5 million Eras Tour tickets could be sold out in a day, contributing to Swift’s i...

Nobody talks about the fact that Taylor Swift is Jewish. Here’s why it matters.

Somehow, a Taylor Swift photo has become one of social media’s great red flags, alongside the Twitter egg and the anime avatar. If you see a Twitter account emblazoned with a Swift portrait, there’s at least a ten percent chance the person behind it is an alt-right, racist troll. That...