Quick tip on how to fix the error which mostly depends on where you are calling the code in your app. In my app for example I use a similar code in two places. Common among them is it tries to determine the first key window in the application regardless of the scene. I have… Read More How To Solve “‘windows’ was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead” warning in Swift.
Struct Value type Copied when passed or assigned Copy on write Functional programming No inheritance “Free” init initializes ALL vars Mutability must be explicitly stated Your “go-to” data structure Class Reference type Passed around via pointers Automatically reference counted Object-oriented programming Inheritance (single) “Free” init initializes NO vars Always mutable Used in specific circumstances The… Read More Swift Struct and Class Difference
Generics are one of the most powerful features of Swift. For example Array and Dictionary types are both generic collections. For arrays it can hold any data types eg. Int, String. Similarly with Dictionary we can store values of any specified data type. Generic Functions A generic function uses placeholder type name called T. T… Read More Working with Generics
Learn how to use swift SpriteKit for beginners. SpriteKit is on of the easiest way to start building games on the iPhone, iPad, Macs and even the Apple Watch and TV. What is SpriteKit? SpriteKit is a game development engine released by Apple in 2013. SpriteKit is best for 2D games and the best way… Read More How to Use Swift SpriteKit For Beginners
You are likely to get this error on CoreData when trying to update the manageObjectContext in the init() of your struct. I was trying calling a function that saves the context upon navigating to a new view from the initializer. A better approach instead is when the view has been rendered use the .onAppear(perform:) modifier… Read More Swift – Solving Fatal error: Unresolved error Foundation._GenericObjCError.nilError, [:]
On this lesson, we will break down operators. An operator is a special symbol or phrase that we can use to check, change or combine values. Terminology Operators are unary (single target), binary( two targets) or ternary(three targets). The values that operators affect are called operands. Assignment Operators We already used this when we were… Read More Swift Basic Operators