What is @objc?

Even if it may seem confusing when you see it for the first time, @objc is just an attribute that allows us iOS developers to make our Swift code accessible in Objective-C.
It can be applied to methods, properties, classes, etc.


@objc func doSomething() {} 


For example, placing @objc before the doSomething() method will make it available in Objective-C and the Objective-C runtime.

Do you want to learn iOS development with visuals? 👩‍💻🧑‍💻

Explore More

Join the LACWE newsletter 📩

Receive free visuals, discount codes, and more.

By joining, you agree to our Terms of Service and Privacy Policy. Unsubscribe at any time.