# Maintaining a Swift and Objective-C Hybrid Codebase

DevFeed: [Maintaining a Swift and Objective-C Hybrid Codebase](<https://devfeed.tech/articles/maintaining-a-swift-and-objective-c-hybrid-codebase-1476.md>)

Original publisher: [Read original article](<https://shopify.engineering/maintaining-a-swift-and-objective-c-hybrid-codebase>)

Author: Adrianna Chang

Published: 2017-06-15T18:13:00Z

Content type: article

Language: en

Sources: [Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering.md>), [Shopify Engineering - Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering-shopify-engineering.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Objective-C](<https://devfeed.tech/topics/objective-c.md>), [interoperability](<https://devfeed.tech/topics/interoperability.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [Code](<https://devfeed.tech/topics/code.md>), [WebKit](<https://devfeed.tech/topics/webkit.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [bridging](<https://devfeed.tech/tags/bridging.md>), [c](<https://devfeed.tech/tags/c.md>), [crash](<https://devfeed.tech/tags/crash.md>), [ios](<https://devfeed.tech/tags/ios.md>), [null](<https://devfeed.tech/tags/null.md>), [optional](<https://devfeed.tech/tags/optional.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [swift](<https://devfeed.tech/tags/swift.md>)

## AI overview

This article explains how to maintain a hybrid Swift and Objective-C codebase when adding new Swift code to an existing actively supported Objective-C project. It discusses interoperability between the two languages and the importance of correct nullability annotations for preserving Swift's compile-time optionality guarantees and avoiding runtime crashes.

## Source excerpt

6 minute read Swift is gaining popularity among iOS developers, which is of no surprise. It's strictly typed, which means you can prove the correctness of your program at compile time, given that your typesystem describes the domain well. It's a modern language offering syntax constructs encouraging developers to write better architecture using fewer lines of code, making it expressive. It's more fun to work with, and all the new Cocoa projects are being written in Swift. At Shopify, we want to adopt Swift where it makes sense, while understanding that many existing projects have an extensive codebase (some of them written years ago) in Objective-C (OBJC) that are still actively supported. It's tempting to write new code in Swift, but we can't migrate all the existing OBJC codebase quickly. And sometimes it just isn't worth the effort.