Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Swift do everything that Objective-C can do?

I am new to IOS developing, and want to use the Swift language instead of Objective-C.

I know few concepts about Cocoa touch, and I want to know : Can Swift do everything that Objective-C can do ?

like image 305
chenzhongpu Avatar asked Oct 19 '25 11:10

chenzhongpu


1 Answers

There are a lot of things that can be done in Objective-C but cannot be done in Swift, without implementing it in Objective-C and then using it from Swift. Some of them include:

  • Catching Objective-C exceptions
  • Using C++ APIs (through Objective-C++)
  • Using NSInvocation, performSelector: and other ways of making calls dynamically where the method to call is chosen at runtime
  • Handling unimplemented method calls using forwardInvocation:
  • Provide a function for use in C APIs that take a function pointer
like image 55
newacct Avatar answered Oct 22 '25 05:10

newacct



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!