Reddit Reddit reviews iOS and macOS Performance Tuning: Cocoa, Cocoa Touch, Objective-C, and Swift (Developer's Library)

We found 2 Reddit comments about iOS and macOS Performance Tuning: Cocoa, Cocoa Touch, Objective-C, and Swift (Developer's Library). Here are the top ones, ranked by their Reddit score.

Computers & Technology
Books
Computer Programming
Software Design, Testing & Engineering
Computer Performance Optimization
iOS and macOS Performance Tuning: Cocoa, Cocoa Touch, Objective-C, and Swift (Developer's Library)
Check price on Amazon

2 Reddit comments about iOS and macOS Performance Tuning: Cocoa, Cocoa Touch, Objective-C, and Swift (Developer's Library):

u/bluk · 3 pointsr/swift

Practically, you can use Swift for anything where you would use Objective-C, but there are a few situations you might use Objective-C and a few times you must Objective-C.

  • If you need to call C code, you might choose to use Objective-C because you may find directly using Objective-C is easier than dealing with Swift's various Unsafe* APIs. Then, you can use Swift to interoperate with your Objective-C code if the rest of your app is in Swift.
  • Objective-C can outperform Swift significantly. Not only in terms of compilation speed but in terms of runtime performance. For instance, the book iOS and macOS Performance Tuning ( https://www.amazon.com/iOS-macOS-Performance-Tuning-Objective-C/dp/0321842847 ) gives some concrete examples. Of course, it depends on your code and where the hotspots are, so you need to measure performance. Swift can be faster than Objective-C, but there are situations where idiomatic Objective-C is naturally faster than idiomatic Swift. However, if you ever find yourself in a situation where you think Swift itself is slow, I would watch some of the WWDC talks regarding Swift performance to try to improve your Swift code before even thinking about re-writing it in C or Objective-C.
  • A very few Apple APIs are still only accessible via Objective-C (e.g. Activity Tracing, XPC, some of the very low level audio frameworks). You'll usually know it when you try to read the headers for the function/method in Xcode (which are more up to date than the online docs) and the auto-generated Swift header doesn't make any sense .

    However even with the above, Swift is a better choice for new development. Apple has decided Swift is the future and is heavily investing in it. Performance is improving with Swift, the language is generally source code compatible for the last two years at least, and every year, more of the few remaining Objective-C only APIs have a Swift overlay.
u/leocnc · 2 pointsr/iosdev

if you're really worried about efficiency you might want to check iOS and macOS Performance Tuning. As everyone else said, there's very little relation between lines of code and performance. If you're getting an awful performance in your app it might be due to methods messing with other threads or poorly designed repetitive tasks.