Generics

How to use generics in Swift? Swift Docs - Generics Swift is a language that lets you write code in different ways. One of the ways is to use generics. Generics let you write code that can work with any type of data. Generics make your code reusable and flexible, without losing type safety or speed. In this blog post, I will explain what are generics in Swift, how to use them in your code, and what are the benefits of using them....

June 15, 2023 · 8 min · Vaibhav Narkhede

Custom Implementation Of Higher Order Functions

What are Higher Order Functions in Swift? Higher order functions are functions that take one or more functions as arguments or return a function as its result. They are powerful tools that can help us write concise and expressive code. Swift provides some built-in higher order functions for collections, such as forEach, map, compactMap, flatMap, filter, reduce, sorted and more. Higher order functions enable developers to abstract common patterns of function applications and make code more concise and reusable....

June 10, 2023 · 11 min · Vaibhav Narkhede

Creating Your Own Swift Package

Creating Your Own Swift Package: An Arithmetic Example Swift Package Manager is a tool that helps you manage and distribute Swift code. It lets you create reusable packages that can be used in your own projects or shared with other developers. It also automates the process of downloading, compiling, and linking dependencies. In this blog post, I will show you how to create a simple Swift package that provides an Arithmetic class with generic methods for addition, subtraction, multiplication, and division....

May 12, 2023 · 7 min · Vaibhav Narkhede

Swift Package Commands

Swift Package Commands: A Guide for Swift Developers Swift Package Manager is a tool that helps you manage and distribute Swift code. It is integrated with the Swift build system and automates the process of downloading, compiling, and linking dependencies. It also supports creating and publishing reusable Swift packages that can be shared across projects and with other developers. In this blog post, I will introduce you to some of the most common and useful commands that you can use with the Swift Package Manager....

May 11, 2023 · 3 min · Vaibhav Narkhede

SOLID Principles of Object Oriented Programming

SOLID Principles SOLID is an acronym for five principles of object-oriented design that help to create clean and maintainable code. In this blog post, we will explore each principle and see how to apply them in Swift. Single responsibility principle (SRP): A class should have only one responsibility. Open/closed principle (OCP): Classes should be open for extension but closed for modification. Liskov substitution principle (LSP): Derived classes should be substitutable for their base classes....

May 10, 2023 · 8 min · Vaibhav Narkhede