0

During my Objective-C days I used to include all the import statements such as UIKit, MKMapKit, and others in the *-prefix.pch file.

However, what's left in Swift is just the info.plist file. So, I will have to repetitively include all the import statements in every swift files included in my project. Therefore, here I wonder if it's possible to so similar practice as how I did with the .pch file in Objective-C?

jscs
  • 63,694
  • 13
  • 151
  • 195
Kann
  • 385
  • 1
  • 6
  • 22
  • 2
    What you did in Objective-C was wrong. Read this: http://qualitycoding.org/precompiled-headers/. It's best practice to import the needed frameworks in each class that needs those. – dasdom May 10 '15 at 06:16

1 Answers1

0

You can put those shared imports in your Objective-C bridging header. When you do this, they will be available to all your swift classes and you wont need to import them over and over.

If you need help creating a bridging header, take a look at this post: https://stackoverflow.com/a/24005242/798682

Community
  • 1
  • 1
mattr
  • 5,458
  • 2
  • 27
  • 22