简体   繁体   中英

project workspace-how to import class from other projects ios

I have added two projects in xcode workspace., set scheme correctly.Is it possible to include or create subclasses of one project in other? Like, I have a class coreViewController.swift which is subclass of UIViewController in one project. I would like to create a class say, exampleViewController in second project which is a subclass of CoreViewController.swift ?

Although I would not do it, it's possible. Just chose File > add file and navigate to the class you want to add to your project. Deselect the copy option, done.

But I would suggest to choose a different approach and remove the class(es) you use in both projects out of both into a separate repository (ie. a framework, git externals, ...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM