6 May 2017

How to Add a .Pch file to Xcode 8 to access some classes throughout Application...


How to Add a .Pch file to Xcode 8 to access classes throughout Application...


1. Open your existing Project Xcode.  Right Click in Project navigator(Left panel which has all Classes folder) > New File > iOS > in this Other a file shown with the name PCH File select it > Next.

2. Give the name to PCH File as YourProjectNameHeaderPrefix.pch  then a > PCH File will be created in your Project.

3. Now add the classes like  e.g.

#import "AppProperties.h"
#import "JsonConverter.h"
#import "WebServiceDefines.h"
#import "Utils.h"

in that file.

4. Then go to Project under that go to TARGETS > Build settings > search for Prefix Header > in Precompile Prefix Header Change NO to Yes > in Prefix Header  add $(SRCROOT)/YourProjectNameHeaderPrefix.pch  

5. Finally Once clean the project Now Check > there is No need of importing those classes in your project to access those classes where ever you want without importing them into a class.

2 comments:

  1. Before we get into how to use XCode on Windows, we should first define XCode. So XCode is an Integrated Development Environment (IDE), which is essentially a very powerful piece of software used to create Mac apps. If you intend to design programmes for the Mac OS, you should be aware that XCode is an Apple-created toolset that will help you get there. Designing apps for Windows is a far more doable effort because you can accomplish it on any platform. However, if you want to create Apple applications, XCode is essential.
    xcode in windows

    ReplyDelete

Recent Posts

Codable demo

Link: https://www.dropbox.com/s/kw7c1kgv1628bh7/codableDemo.zip?dl=0