Importing UIKit.

Greetings everyone.


My app is a series of ViewControllers that have a grid of UIImage views that display .png files. Sometimes when there is an animation playing on the page, I have a UIView to as a container (if I am using the right term). For the animation I use AVPlayer. I also have sounds that play independently from the videos on each page using SystemSoundID. To do all this, I import AVFoundation.

Now when I started this project so long ago, I hardly knew what I was doing (I'm a little better now) and I also Imported UIKit and I have done this on with every class in my project. Lately, on a whim, I commented out #import UIKit and my app still works. So I looked up the purpose of Importing UIKit in the first place and what I read wasn't very clear. So I am still in the dark.


If I get rid of this import, and my app works perfectly well. Isn't that a good thing? I mean why import it when I don't seem to need it?


Can someone shed some light on this for me?


JR

Do you import something else ?


In Swift :

By default, UIViewController is created with import UIKit.

If I comment it out, I get compiler errors (as UIViewController not defined)

Hello Claude31.


I haven't touched Swift. I'm still trying to get good at Objective C.


Do I import something else? No. Just AVFoundation and UIKit. Now if I comment out AVFoundation, I get compiler errors all OVER the place.


If I comment out UIKit, my compiler & therefore my app don't even notice it. Before I get rid of UIKit, I just thought I should go on this forum and get the opinion of others.


JR

Answer is...it depends - and, it might not be as gone as you think.


Some discussion here: http://stackoverflow.com/questions/2283132/should-i-import-uikit-in-every-file-i-code

Importing UIKit.
 
 
Q