Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Following Apple's guidelines for iOS Static Libraries #249

Merged
merged 1 commit into from
May 15, 2014
Merged

Following Apple's guidelines for iOS Static Libraries #249

merged 1 commit into from
May 15, 2014

Conversation

evandelaney
Copy link
Contributor

Cocoa Lumberjack Team,

This pull request may not interest you given the continued effort put into maintaining the CocoaPods spec, but I'm optimistic that there are others like me that prefer to use bare git submodules and a static library.

I've reworked the iOS static library project to follow Apple's recommendations in this tech note. If the Apple link changes, then you should be able to find it by searching the phrase "Using Static Libraries on iOS." This puts exported headers in an expected place (however much water that may hold), and does not require changes to a target app's Search Paths build settings.

I've found these modifications to the Lumberjack static lib helpful for my projects. Maybe others will, too.

I welcome discussion about why you think this is a beneficial or not-so-great pull request; this is my first contribution to the community and I'm hoping to learn from the experience. I've enjoyed using CocoaLumberjack, and I'm hoping this might be a small way to show my support.

@@ -1,7 +1,7 @@
#import "AppDelegate.h"
#import "ViewController.h"

#import <Lumberjack/Lumberjack.h>
#import "Lumberjack/Lumberjack.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import can (and probably should) stay unchanged. The reason being that if "search headers path" is properly configured then <...> imports should work.

Also it better isolates library headers, is less tied to particular directories/paths and migrating to/from CocoaPods<->Static Library is easier.

Apple's documentation chose to use "..." without making it a guideline. More info here.

@rivera-ernesto
Copy link
Member

I was about to propose to abandoning the Static Library as recent development has not been "back-ported" for it (CLI and soon ASL Capture for instance).

If someone however finds it useful and wants to maintain it then great. The code however should stay as CocoaPods/Static Library-agnostic as possible.

@evandelaney
Copy link
Contributor Author

Your comments about angle brackets above don't exactly make sense to me - It's a little over my depth. Is there a resource where I could learn more? I'd be happy to maintain the static library for iOS.

@rivera-ernesto
Copy link
Member

Just added a link to the first comment.

@rivera-ernesto
Copy link
Member

@evandelaney after checking this (and this) do you still prefer to change the imports before we merge this?

@evandelaney
Copy link
Contributor Author

Sorry, still getting my bearings. Gimme until the end of the week, please.

@rivera-ernesto
Copy link
Member

Sure, not meant to push you, it was just a ping ;)

@evandelaney
Copy link
Contributor Author

Summary:
Yes, leaving the angle brackets is okay.

Discussion:
So, I better understand #import "..." vs. #import <...> from then links you posted (thank you!), but I'm still unclear on how angle brackets in Lumberjack.h effect or require the Header Search Path build setting.

The suggested changes have modified the Lumberjack.xcodeproj "Build Phases," and now the .h files are copied into Build/Products/<build config name>-<platform>/include/<target name>/. So, for example this results in Build/Products/Debug-iphoneos/include/Lumberjack/. When I bring the Lumberjack.xcodeproj into a workspace, the workspace target's Build Settings don't need to be changed; any source file can #import "Lumberjack/Lumberjack.h", build, and it works.

There is no change in this behavior if Lumberjack.h uses quotes or angle brackets for import.

The behavior / use case outlined above is what my intention was behind this pull request, but I still feel like I may have missed something important around #import "..." and #import <...>.

(Sorry for the delay on this, I got slammed with work)

@rivera-ernesto
Copy link
Member

Well the idea of using #import <.../...> is to encapsulate libraries and their headers and keep them separate from the host application. All references from outside CocoaLumberjack should use those imports and they will work with both a static framework and CocoaPods and that's the reason why you use the same syntax for any Apple framework and library.

More important with this syntax any header conflict can be solved without touching any source file import, but by simple adjusting the project's HEADER_SEARCH_PATHS.

On the other hand references inside your project use #import "..." because the file and the header it references live in the same project/directory/namespace at all times. That's also why code inside CocoaLumberjack or inside any Apple library uses this syntax.

@bpoplauschi
Copy link
Member

Gentle reminder guys

@rivera-ernesto
Copy link
Member

Just checked again my two comments.

Uses the Xcode 5.1 iOS Static Library template and methodology outlined in the tech note linked below

https://developer.apple.com/library/ios/technotes/iOSStaticLibraries/iOSStaticLibraries.pdf
@evandelaney
Copy link
Contributor Author

@rivera-ernesto I've pushed the suggested change, and it certainly won't upset me if you still feel like these changes aren't appropriate for the project given the effort put into supporting CocoaPods. I've come away with a better understanding about #import<...> vs #import "..."

@rivera-ernesto
Copy link
Member

Looks good. Thanks!

rivera-ernesto pushed a commit that referenced this pull request May 15, 2014
Following Apple's guidelines for iOS Static Libraries
@rivera-ernesto rivera-ernesto merged commit 8227578 into CocoaLumberjack:master May 15, 2014
@bpoplauschi bpoplauschi added this to the 1.9.0 milestone May 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants