crazymanish / SwiftCoding

A set of blog posts about Swift Coding

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swift Coding

A collection of blog posts about Swift coding

I hope this set of articles is of use to you!

Photo by Drew Hays on Unsplash
Photo by Mad Rabbit Tattoo on Unsplash

For the best free guide for Swift coding use CS193p, a wholly online course focussing on SwiftUI.

Articles

Quick Guides

The UITableView Example
The Programmatic UITableView Example
init
Create a UICollectionView programmatically
Create a UITableViewCell programmatically
Zap the SceneDelegate in iOS 12 and just use the AppDelegate
Delete Storyboard (Xcode 14 Edition)

Beginner

Using a XIB File with a UIView Subclass
The Only UIStackView Guide You Will Ever Need
Imperative vs. Declarative Swift Programming
Default Arguments
Write Programmatic Constraints for Swift Projects
Ranges in Swift
Property Observers in Swift
Zip and Zip2Sequence in Swift
Overcoming Default Arguments in a Protocol
Make it snow!
Swift Lint installation
Storyboard Constraints
Simply Optionals
Functions
Overriding
Properties
TableViewTwoOneViewController
Index Out of Range Exception: The Swifty solution
For Loop
Remove elements from an array during enumeration
Enums
let or var in Swift, and why it absolutely matters
The Remainder Operator
Divide and Conquer Algorithms Using Swift
The Inspector Bar in Xcode
Create UISteppers in Swift (Tutorial)
All Your Outlets Should Be Private
Use SwiftUI Previews in UIKit
My Computer Can't Count
Connect Storyboard Objects to Code
Use Swift Package Manager to Add Dependencies
Which Way is Up? Normalized Coordinates in Swift
Swift Helper Functions
Use a Base Class or a Protocol In Swift?
Avoid Swift's Optionals Through Laziness
Can You Answer This Swift Question Correctly?
Avoid Swift's Optionals Through Laziness
SwiftUI's AsyncImage
Metatypes in Swift
What is a ProjectedValue in SwiftUI?
Space UITableViewCells in a UITableView
Understanding Swift's IndexPath
Mastering the Three Phases of iOS Layout with Auto Layout
Swift's Type annotations
Type Properties in Swift
Battle of the Data Structures: A Comparison of Set and Array in Swift
Don't be Confused Between Reusable and Generic as a Swift Coder!
High Cohesion SwiftUI Code
Use Inset for UITableViewCell
Using JSON in Swift code (++ Testing)
Adding a UITabBarController
Extract A Swift Prototype Cell
Use AttributedString in SwiftUI Before iOS 15
Swift Actors: Manage Concurrency and Prevent Data Races
Set up an Xcode development certificate
Harnessing the Power of Tab Bars in SwiftUI
New in Swift 5.9 (WWDC 2023)
New in UIKit (WWDC 2023)
WWDC 2023: Discover Observation in SwiftUI
WWDC 2023: Discover String Catalogs
WWDC 2023: Write Swift Macros
WWDC 2023: Meet Swift Data
The @Environment && @EnvironmentProperty SwiftUI Property Wrappers
The @State Property Wrapper
Use IBSegueAction To Make Storyboards Less Awful
The @Binding property wrapper
Global actors in Swift Concurrency

Easy

SEE Retain Cycles in Xcode
New Features for iOS 14: SwiftUI
|Hello, World" SwiftUI
Text Scroll with SwiftUI
|Create a Horizontally Scrolling UICollectionView with Dynamic Cell Sizes
Debug using Breakpoints in Xcode
Use lldb to Dynamically Change Code in Xcode
The Singleton
viewDidLoad() Vs. loadView()
Core Data with SwiftUI
The UINavigationController and UINavigationBar in Swift
Use Charles to Rewrite Responses Developing iOS Apps
Stack Overflow's Most Downvoted Swift Question
Using Swift's CustomStringConvertible
Segues in Swift
Visual Memory Debugger
Swift initializers
Initialising a view controller from a test using Swift
Using IBDesignable and IBInspectable in Swift
Detect iOS Shake Gestures: Swift
Create a CustomUITableViewCell in a UITableView
Handle Button Presses in CustomUITableViewCells Without Tags
Stride in Swift
Listing enum cases using CaseIterable in Swift
NSAttributedString vs NSMutableAttributedString
Overriding the default font in Swift
Common errors when using custom fonts in your iOS App
Learning UITesting using Xcode
Gradients in Swift
Using Git with Xcode
A Swift YogaKit Guide to Flexbox
A Localize Swift Tutorial
Memory leaks using the Xcode memory graph debugger
MVC in Swift
UIScrollView with Auto Layout implemented in Interface builder
Access control in Swift
FibonacciSeriesInDepth
CleanUITableViewControllers
WOOT! Supercharge Result Type using Swift's get()
What is intrinsicContentSize Anyway?
Intrinsic Content Size: Swift's Sizing Mystery
Containing Child View Controllers for iOS Apps
Lazy Loading images
Sorting Dictionaries
Fix Those Annoying Separator Lines in Swift
Coping with a long parameter list in Swift
Why Do We Call Super When Making iPhone Apps?
Why Use LayoutSubviews Anyway?
Subclass or Extend classes in Swift
Copy-On-Write
Can You Write Pure Functions in Swift?
Decode JSON Like A PRO
View Tags
Create a Custom UIAlertView in Swift
Multiple Initializers
A Basic UISearchViewController (Swift Tutorial)
Stop SPAMMING your API from a UISearchController
Views shouldn't know about threads
The UIPickerView Guide (Swift Tutorial)
SwiftUI Property Wrappers
A Mixed Economy: Xib and Storyboards
A Gradient Layer Below a UITableView
I've finally mastered Case Let
Radians Are Useful In Swift
Practical Reference Cycles in Swift
What is the @Published Property Wrapper?
Retain Cycles and Memory Management in Swift
Unwrap an Array of Optional Values Using Swift
Self or self in Swift Code
Animate a Bar Button Item using Swift
Create a UIKit UISegmented Control
Animate an Icon in Swift
What the ZSH is ZSH, and what is BASH anyway?
Subclassing a UIButton Using UIKit
Did You See This? A Measurement Class In Swift
The Lazy Variables: What and Why in Swift
Create A Working UIScrollView Programmatically
Testing Location Dependent Swift Code
Create a UINavigationController With a Gradient as a Background
A StringBuilder for Swift
Breaking Down String Format Specifiers in Swift
Swift Initialization
Benchmark Swift Code
Which Thread Are You Using in Swift?
Core Concepts of Combine
Pass Data in iOS Apps
Lazy NavigationLink for SwiftUI
SwiftUI MVVM with Networking
File Persistence in Swift
Fastlane: Simplify Deployment
Levelling up Swift Development with Test-Driven GitHub Copilot
CALayers: A guide
From Idea to App Store: How to Build an iOS App Using AI-Powered Development with OpenAI and ChatGPT Part 1
From Idea to App Store: How to Build an iOS App Using AI-Powered Development with OpenAI and ChatGPT Part 2
From Idea to App Store: How to Build an iOS App Using AI-Powered Development with OpenAI and ChatGPT Part 3
Make Your Swift Arrays Safe
Imperative vs. Functional Swift Programming
Offscreen Rendering in iOS
Use an Enum to Decode JSON in Swift
Efficient UIKit Shadows
How I Would Mock A Swift Timer
Decouple Your Classes in Swift
Implement Polling in Swift
Testing the Sandwiches SwiftUI WWDC Code
The ViewBuilder Attribute
SwiftUI's Namespace

Normal

Semaphores
Throw inside a closure
A Networking Manager with Alamofire
Use OperationQueue to Chain API Calls in Swift
Did Apple Kill UITableView? - UICollectionView Lists
Property Wrappers
Compositational Layouts
MVVM-C
MVC
VIPER
Theoretical VIPER
MVVM
MVVM RxSwift
The MVI Architecture Pattern in Swift
Using Redux and Swift
Loading Animation
The Only CAGradientLayer Guide You Will Ever Need
Combine and URLSession in UIKit
Parallel Programming with Operation and OperationQueue in Swift
Dark Mode iOS
iOS11 Compatibility
KeyPaths
Swift Package
ThreadSafeArray
ServiceLocator Pattern
StatePreservation
Cache URLResponses in Swift
MVVM Dependency Injection using Storyboards
Recreate the SwiftUI Sandwiches WWDC demo
Use SwiftUI in a Playground
Write a Network Layer in Swift
Encode Behaviors into Reusable View Controllers
Embed a UICollectionView Inside a UITableView
A UIGestureRecognizer tutorial
Decode JSON in Swift: A Full Micro-Project
Dependency Injection using Storyboards
Using Data Transfer Objects (DTO) in Swift Code
Do enum Types Conform to Hashable in Swift?
Two-phase Initialization in Swift
Annotation
Namespacing
Extensions
A Practice OAuth Token with Postman and Swift
Mocking Network Calls in Swift
hitTest(_:with:) vs point(inside:with)
Generics in Swift
How to Test Asynchronous Functions Using Expectation in Swift
downloadTask(with:completionHandler:) vs. dataTask(with:completionHandler:)
Test Driven Development (TDD) in Swift
Debug with the DEBUG preprocessor macro in Xcode
A SwiftMonkey Tutorial
If you’re using a base class in Swift, you’re doing it wrong
MVVM with RXSwift
Learning Dependency Injection using Swift
Injecting Services into Swift Apps for testing
MVVM: A Tutorial and Practical Example in Swift
Can you use Swift to replace a UIPageView with a UICollectionView?
A NSNotificationCenter implementation in Swift
An animated UIPageControl — from scratch in Swift
Your own subscript in Swift
The hidden workings of UITableView
Using NSNotificationCenter in Swift
Create your own backend while developing a Favourites Section
Handle TimeStamps
DispatchGroups to group API calls in Swift
THIS is how to store money and currency using Swift
Create a CurrencyField in SwiftUI (MINUS UIKit)
Using Type-Safe Identifiers in Swift
Create Instagram's Pinch to Zoom using Swift
Create a SwiftUI Tip Calculator
Create an Image Carousel Using Swift
iTerm
The MVP Architecture for iOS
Pass The Swift Code Review: Dictionary Edition
Play Video in a UICollectionView
Using SwiftUI Views with UIKit
The MVP iOS Architecture with Coordinators
Reuse a UITableViewCell as a UIView
Implement a Service-Oriented Architecture in Swift 5
SwiftUI Authentication
Implement Optional Protocol Methods in Swift
Idempotence
Pass Parameters in Tap Gestures
A Screaming Architecture for iOS Projects
Public Getters and Private Setters in Swift
Bézier Path and Curves Using Core Graphics
Why do we ever need to inherit from NSObject?
What Is The Difference Between The Liskov Substitution Principle and Dependency Inversion Principle?
Animate UIViewController Transitions with UIViewControllerAnimatedTransitioning
Snapshot Testing In Swift
Dynamically Change Fonts for your User (Dynamic type iOS)
Method Dispatch in Swift Protocols and Inheritance
What is a RunLoop Anyway? Swift and iOS Guide
Swift Swizzling
ERD Diagrams for Core Data in Your iOS App
Access Memory Directly in Swift
Fade the First and Last Elements in a UICollectionView
Dynamic Row Heights for a UITableView
Understanding Swift's Opaque Types
Wrap a Model View in a UINavigationController
Decoupling The Segue In Swift
Lookup UK Postcodes: Can We Use A UISearchBarDelegate?
Pinch to Zoom a UICollectionViewCell in a UICollectionView
Stop Using Swift Timers: Use CADisplayLink
Using UICollectionView and UICollectionViewDiffableDataSource
Adding Fields To A Backend Response. What Will Happen? Swift Edition.
Instruct Your View With A ViewModel: Should It Be A Class or a Struct?
Advanced Codable: Missing Fields In Arrays (Swift)
Count the Number of Properties in a Struct
Auto Mocking with Sourcery
Create a Circular Transition in Swift
Dependency Inversion - A Swift guide
AES for iOS Developers, Using Swift
Transformable Core Data: UIColor
iOS Data Protection APIs, Using Swift
Understanding Swift's ConvertPoint
UICollectionViewLayoutGuide for Swift iOS Apps
Swift Threads: The Guide
Using SQLite Directly with Swift
Create a Stateful Loading Button in Swift
Use UICollectionViewFlowLayout and Let It Rotate!
Snapshot Individual Views in Swift
Data Races in Swift
Double Dispatch in Swift
Create Loads of CountDown Timers in iOS Swift
Sign in with Apple: Swift Coding
Reachability for iOS Swift Applications
Unit Test Gesture Recognizers
Mocking NWPathMonitor for Swift UI Testing: Overcoming Connectivity Challenges
Mastering ObjectIdentifier in Swift

Challenging

TypeErasure
TwoWayBinding
Track My Movement: A RxSwift Project
Secure iOS Apps Through App Pinning
Create Flexible Components in Swift
Animate Swift's button labels
Function Currying (and Uncurrying) in Swift
Monad, Functor and Applicative Swift Functions
Make All Your Swift UIKit Views a UITableView
Custom UIViewController Animations - EASY iOS Guide
Use the Decorator Pattern for Repository Caching and Cache Invalidation
Using Lenses in Swift

Core Data
The Core Data Stack: Persistent Store Types
Learning the Basics of Core Data
Core Data: Using Codable
NSPredicate with Core Data
Core Data Basics: Testing

Tips

What Is The Difference Between @escaping and @nonescaping Closures in Swift
Throw or Rethrow that Error?
How Implicit Return Types Removed that Annoying Swift Inconsistency
Code snippets
Playgrounds
Parse JSON without knowing the type
Get a Comma Separated List From An Array
That little Swift Bug: Protocol Customization Points
Shorthand Parameters in Swift
Avoid Nesting Functions in Swift
Can You Answer This Swift Question Correctly?
Xcode: Not Using Source Control? Save Resources NOW
That One Method Dispatch Pitfall
Can You Answer This Swift Dictionary Question?
Mastering GitHub Copilot
GitHub Copilot: The AI-Powered iOS Programming Assistant You Need to Try
Which of these properties COULD cause a Swift Retain Cycle
iOS Developers Should Avoid These 5 Common Mistakes
Running Shell Commands from Breakpoints

Theory

Kruskal’s Algorithm in Swift
WWDC Notes: Keynote
WWDC Notes: Platforms
Semantic Versioning
The SOLID Principles Applied to Swift
Writing FIRST Swift Tests
The Union-Find Data Structure in Swift
Favor composition over inheritance — in Swift
Tries in Swift
Data Structures: Linked Lists
KVO vs NotificationCenter
The iOS App Development Process
Linked Lists and LL Algorithms in Swift
Data Races in Programming
The Boy Scout Rule in Coding
Finally! DevOps Explained
Scaling iOS Software Development
Single Responsibility Principle in Swift
How does Assembly work — A Swift guide
Data Races in Programming
Actors in Programming
The Halting Problem
The Strange Case of Georg Cantor, the Diagonalization Argument and Closed Minds
Turing Machines
Merge Sort in Swift
Insertion Sort in Swift
The Readers-Writers Problem
Should I Learn UIKit or SwiftUI

Agile
Run Agile from Home: The Sprint Retrospective
Kanban or Scrum?

Design Patterns

The Mediator Design Pattern
The Factory Pattern
The Façade Design Pattern in Swift
The Adaptor Design Pattern
The Iterator Design Pattern in Swift
The Chain of Responsibility Pattern in Swift
The Decorator Design Pattern in Swift
The Builder Design Pattern In Swift
The Visitor Design Pattern in Swift
The Strategy Design Pattern in Swift
The Prototype Pattern in Swift

General iOS

Storing Payment Data On iOS: My Take
Should We Learn UIKit or SwiftUI in 2023?
How I Blog Daily As An iOS Software Developer

Concurrency

Swift's Future Class
Mutable State In Swift
Mastering Swift: Create Your Own Property Wrapper
Mastering Concurrency in Swift: Understanding Grand Central Dispatch Quality of Service
GCD Barriers in Swift: Synchronising Concurrent Tasks
Synchronizing Concurrent Tasks in Swift with NSLock
How To Use Async let To Simplify Asynchronous Fetching in Your SwiftUI App
Swift Concurrency: Working with MainActor to Manage Task Execution
Swift Concurrency for Beginners: Getting Started with Async/Await
The Power of Tasks in Swift: Concurrency Made Easy

LeetCode

Leetcode Weekly Contest 194 Swift solutions
Leetcode Weekly Contest 195 Swift solutions
Leetcode Weekly Contest 197 Swift solutions
Leetcode Weekly Contest 216 Swift solutions
Leetcode Weekly Contest 217 Swift solutions
PrefixSum
Using an Array as a built in index for LeetCode problems
Swift: Using BFS for LeetCode problems
Swift: Using Depth-First Search for LeetCode Problems
Swift: DP (draft)
Swift: Playgrounds are Worthwhile for LeetCode
Two Sum / Three Sum (draft)
Avoid Playgrounds, for Swift LeetCode challenges
URLify Create A URL From A String in Swift
Floyd's Cycle Detection Algorithm In Swift

Get in touch

I'm usually around on Twitter

Feel free to sign up to my newsletter

About

A set of blog posts about Swift Coding


Languages

Language:Swift 98.8%Language:Makefile 0.5%Language:Ruby 0.4%Language:HTML 0.3%Language:Objective-C 0.0%Language:Hack 0.0%Language:Java 0.0%Language:Shell 0.0%Language:Python 0.0%