Re: Proper way to set up constants when building an iOS framework
Re: Proper way to set up constants when building an iOS framework
- Subject: Re: Proper way to set up constants when building an iOS framework
- From: Alex Zavatone <email@hidden>
- Date: Tue, 19 Apr 2016 14:27:21 -0400
On Apr 19, 2016, at 2:18 PM, Gary L. Wade wrote:
> In a Terminal window, start off with this command:
>
> find /Applications/Xcode.app/Contents/Developer/Platforms -type f -print0 | xargs -0 grep FOUNDATION_EXPORT
If this would expose my constants outside my framework, this is what I do not want.
I'm simply trying to get all my classes within my framework to see the constants without having to import the constants.h file in every single class of my framework.
I'd like to import my constants from 1 file within my framework and have all classes of my framework be able to see and use the constants.
Just like how we would do it within an app.
Sorry this is going on so long, but all I'm looking for is to set up a simple constants file that works in a framework (and only for my framework) just the same manner they work within an iOS app.
Currently, I have not been able to locate any resource that explains how to import the constants into 1 file (within its own framework) and expose the constants to all the classes of that framework.
FYI, I'm building this framework. That's why I want the constants to apply to this framework.
Thanks.
>
> Then go to opensource.apple.com and look around.
>
> Note those are zeros, not capital O's if you type the command out vs copy/paste.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
>
>> On Apr 19, 2016, at 11:11 AM, Alex Zavatone <email@hidden> wrote:
>>
>>
>>> On Apr 19, 2016, at 1:38 PM, Gary L. Wade wrote:
>>>
>>> Another thing I do is add FOUNDATION_EXPORT before my constants in headers, which will give you the right stuff whether C or C++; C++ name mangling is a common reason for odd link errors if you include a header in a C++/Objective-C++ source file.
>>>
>>> I'm sure you can find examples of this in open source, and Apple's own open source has these, too. If something isn't working, you're better off showing concrete examples from here on out.
>>> --
>>> Gary L. Wade (Sent from my iPhone)
>>> http://www.garywade.com/
>>
>> I've looked all around for this, have been pulled of on to other projects and am back trying to get this to work. I can't find this explained anywhere.
>>
>>>> On Apr 19, 2016, at 10:20 AM, Alex Zavatone <email@hidden> wrote:
>>>>
>>>>
>>>>> On Apr 16, 2016, at 7:19 AM, Uli Kusterer wrote:
>>>>>
>>>>> A precompiled prefix header is a compile-time construct that only applies to the interior of your framework. You can't really tell people linking to your framework to add a certain prefix header. So you can use a pch for actually writing the framework implementation,
>>>>
>>>> That is all I am trying to accomplish.
>>>>
>>>> So, since we have to create a constants file in a framework with .h and .m files, I've never seen a .m compliment to a .pch. I have no idea how this would work at all or how I would be able to set this up.
>>>>
>>>> What I am trying to achieve is simply declare constants for all my classes within a framework (and only for the framework) and do it in one spot.
>>>>
>>>> It is my understanding that in a framework we need .h and .m files to declare the constants and I have set these up.
>>>>
>>>> Now, I am trying to get this constants.m imported in one area that will allow every class within my framework to have access to them.
>>>>
>>>> Thanks, Uli.
>>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden