Swift and Objective-C

Share:

These questions were only shown to the developers who chose Swift or Objective-C as one of their three primary programming languages.

Which Apple platforms do you develop for?

91%

iOS

34%

macOS

10%

watchOS

4%

tvOS

3%

I don’t develop for Apple platforms

Do you use Swift and Objective-C together in the same project?

62%

Yes, most of my codebase is in Swift

23%

Yes, most of my codebase is in Objective-C

16%

No

Most of the new projects being created are written in Swift, but larger companies still often support legacy Objective-C frameworks

Krzysztof Zabłocki

Creator of Sourcery and other OSS projects which power 80k+ apps

Do you write unit-tests for your Swift or Objective-C development?

Cross-platform developers

All

Mobile developers

Cross-platform developers: Swift or Objective-C users that use cross-platform technologies. Mobile developers: Swift orObjective-C users that develop for mobile platforms.

Testing in the community has gotten better in the last few years, but it's still pretty bad in comparison to other stacks. Some of it is a lack of proper education from Apple, and some of it is poor architecture choices, given that writing tests for MVC is more complicated than in other architecture patterns.

Krzysztof Zabłocki

Creator of Sourcery and other OSS projects which power 80k+ apps

There is still a significant opportunity for Swift/Objective-C developers to embrace unit testing. Those who do will stand out from the crowd.

Jon Reid

Coach and Trainer at Industrial Logic, Author of iOS Unit Testing by Example

Which unit-testing frameworks do you regularly use?

94%

XCTest

11%

Quick + Nimble

2%

Other

Apple has made significant improvements to XCTest and Xcode support for testing. I've seen a lot fewer people using alternative frameworks than in past years, as the cost of the learning curve and dealing with support issues usually outweighs the benefits.

Krzysztof Zabłocki

Creator of Sourcery and other OSS projects which power 80k+ apps

Which mock / matcher frameworks do you use?

6%

OCMock

5%

SwiftHamcrest

5%

OCMockito

3%

Cuckoo

1%

OCHamcrest

2%

Other

81%

None

Do you use UI tests?

Cross-platform developers

Mobile developers

All

UI Tests are much slower to run and often less reliable, they aren't great for TDD workflow, and most companies don't run them on each PR. Instead they are scheduled on CI or nightly builds.

Krzysztof Zabłocki

Creator of Sourcery and other OSS projects which power 80k+ apps

Which UI testing frameworks do you regularly use?

71%

XCTest

14%

iOSSnapshotTestCase

13%

EarlGrey

8%

KIF

4%

Other

Which dependency manager do you use?

61%

CocoaPods

47%

Swift Package Manager

11%

Carthage

1%

Other

18%

None

75%

CocoaPods

41%

Swift Package Manager

12%

Carthage

2%

Other

11%

None

69%

CocoaPods

47%

Swift Package Manager

12%

Carthage

2%

Other

12%

None

Do you plan to replace CocoaPods dependencies with SPM packages?

Which database engine / framework combination do you use?

31%

Firebase

28%

CoreData

28%

SQLite with my own wrapper

24%

Realm

1%

YAPDataBase

3%

Other

26%

None

41%

Firebase

23%

CoreData

37%

SQLite with my own wrapper

27%

Realm

4%

Other

20%

None

35%

Firebase

29%

CoreData

29%

SQLite with my own wrapper

28%

Realm

1%

YAPDataBase

3%

Other

21%

None

Do you develop with Swift on Linux?

5%

Yes

13%

No, but I plan to in the next 12 months

83%

No, and I don’t plan to in the next 12 months

Do you develop server-side projects using Swift?

2021

2022

I’m not really surprised to see a slow rate of adoption here since it's still a pretty new stack in comparison to the alternatives. But I spoke to a bunch of engineers working with Swift on Server, and all I heard was praise regarding how well it works.

Krzysztof Zabłocki

Creator of Sourcery and other OSS projects which power 80k+ apps

Swift and Objective-C:

2022

Thank you for your time!

We hope you found our report useful. Share this report with your friends and colleagues.

If you have any questions or suggestions, please contact us at surveys@jetbrains.com.