Seungyoun Yi Seungyoun Yi - 4 months ago 11
Swift Question

Advantages of change Hybrid Code(Objective-C and Swift) to only Swift Code

Title is what I want to ask. I have Objective-C code and Swift code both with bridge-header. But Is there any advantage to change code to only swift2.2 code? If it is reasonable, I want to change. Thank you in advance
(Need some proven data to assure me) :)

Answer
  • Swift code runs faster.
    • Objective C methods are always dynamically dispatched, whereas in many cases, Swift method calls can be optimized to be statically dispatched.
    • Swift provides stronger type information to the compiler, allowing for more aggressive optimisation
  • Swift code is better for developers
    • More concise. Objective-C is well known for its boiler-plate
    • "Fun" to write
    • More informed type information provided by the IDE
  • Swift code is safer
    • Optionals eliminate a whole class of nil messaging errors
    • Swift's superior type system, including generics, require less unsafe casting.
Comments