Why You Need To Be Careful With Objective-C Bridging in Swift

Why You Need To Be Careful With Objective-C Bridging in Swift

Be aware of custom types and upcasting

Bridging to/from Objective-C is an important part of Swift development due to the Obj-C history of Apple’s platforms. Unfortunately, there are some hidden caveats that could lead to bizarre situations that would be impossible in a pure Swift environment. When dealing with Objective-C types, it’s useful to check if they don’t have a history of being too different from their Swift counterparts.

The reason for this caution is that bridging can be completely hidden from you. As you might know, Swift developers can use the as upcast operator to convert a type to one of the superclasses or protocols that it inherits from:

There is no change in functionality between myViewController and viewController because all the operator does is limit what you can access from that type. Deep down, they are still the same object.

ios xcode swift programming

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Best Swift iOS App Development Company in USA & India

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

The ultimate guide to iOS Unit Testing with Swift and Xcode

Unit testing is a testing method where you can test “unit” of code whether it is working as you want or not. In Xcode, use XCTest…

Top Swift iOS App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Hire Expert Swift iOS App Developers in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

HOW TO BUILD CUSTOM ALERT DIALOG BOX FROM SCRATCH STEP BY STEP USING SWIFT iOS XCODE 11.4

Topic: HOW TO BUILD CUSTOM ALERT DIALOG BOX FROM SCRATCH STEP BY STEP USING SWIFT iOS XCODE 11.4 Subscribe Us: http://bit.ly/2UaSC5s Find us on: Discord: htt...