Swift version: 5.1
This is one of those things that sounds obvious in retrospect:
AnyObject is Swift's way of saying, "I don't mind what type of object you pass in here, it could be a string, it could be a string, it could be a number, it could be an array, or it could be a custom type you defined yourself.
If you were wondering: the reason numbers work even though they clearly aren't objects is because Swift silently makes them objects when they need to conform to
LEARN SWIFTUI FOR FREE I have a massive, free SwiftUI video collection on YouTube teaching you how to build complete apps with SwiftUI – check it out!
Available from iOS 7.0
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.