Swift Basics: Array vs. Set @seanallen
Swift Basics: Array vs. Set  @seanallen
Uploaded March 2023 | Updated September 2026, 7 hours ago
Go to squarespace.com/seanallen to save 10% off your first purchase of a website or domain using code SEANALLEN.

Most iOS developers instinctively reach for an Array when using collections in Swift. I recommend stopping and thinking if a Set would work better. Sets offer better performance as well as a bunch of powerful methods to compare Sets.

This tutorial was created using Xcode 14 and iOS 16.

My iOS Dev Courses:
seanallen.teachable.com/?video=_TvQPMZdwPI

iOS Developer Interview Questions Playlist:
youtube.com/playlist?list=PL8seg1JPkqgF5wazzCKSq3EEfqt3t8mvA

Twitter:
Sean Allen - twitter.com/seanallen_dev

Hired.com:
hired.com/x/1n01g

Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):

Paul Hudson's Hacking With Swift:
gumroad.com/a/762098803

Donny Wals - Combine:
gumroad.com/a/909014131

Mark Moeyken’s SwiftUI Books:
bigmountainstudio.com/swiftui-views-book/fzc51

Objc.io Books (Thinking in SwiftUI & Advanced Swift):
gumroad.com/a/656585843

#swift #softwaredeveloper #iosdeveloper

Timestamps:
0:00 - Is there better?
0:29 - Array vs. Set
1:33 - Time Complexity
2:20 - Code Examples
2:47 - Intersection
3:48 - Subtract
4:44 - Disjoint
5:22 - Union
6:06 - Symmetric Difference
7:03 - Subset & Superset
7:55 - Insert, Remove, Contains
Swift Basics: Array vs. SetIntro to Programmatic UI - UIKit | Xcode 14This surprising tactic got my apps first paying users - Build, Ship, Profit #2Request App Ratings & Review - SwiftUI | iOS 16 | Xcode 14Dont Make These Mistakes in Your Pull RequestsSwift Generics for Beginners - Eliminate Code DuplicationMy Favorite SwiftUI Updates in iOS 18Liquid Glass - 5 Things You MUST Know Before ImplementingWWDC 2025 Dates, SwiftUI Fundamentals, Optimization & Ugly PaywallsSwiftUI Fundamentals | FULL COURSE | Beginner FriendlySimple, Clean Empty States in SwiftUI - ContentUnavailableView - iOS 17Swift on Android, SwiftUI in iOS 26, Foundation Model, Ship-a-ton, & More
Sean Allen |

Swift Basics: Array vs. Set

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER