Carthage and GoogleMap - ios

Is it possible to install GoogleMap SDK via Carthage?
I only saw the tutorial for Cocoapods only.
Or I only can install manually if I am using Carthage?

According to Carthage docs:
The only supported origins right now are GitHub repositories (both GitHub.com and GitHub Enterprise)
Carthage actually builds binary framework from the sources it checkouts from the specified repository. Developer needs to link this built binary frameworks to the project afterwards.
Google already provides you with the binary version of GoogleMaps framework instead of sharing sources. Therefore all you have to do is just download this binary from official website and link it to your project without using Carthage. So you can say that Google has already done Carthage work for you so you don't have to use Carthage to build GoogleMap framework. And I believe you even couldn't if you want to because GoogleMaps source code is not open.
Hope my answer will be helpful for you.

Carthage supports linking directly to binary assets.
If you go to the "Manual Integration" section in the documentation page, you'll notice the download link looks something like this:
https://dl.google.com/dl/cpdc/d308af63f78a5a1a/GoogleMaps-3.1.0.tar.gz
So all you have to do is create a local JSON file called something like GoogleMaps.json, and put the following in it:
{
"3.1.0" : "https://dl.google.com/dl/cpdc/d308af63f78a5a1a/GoogleMaps-3.1.0.tar.gz"
}
Then, in your Cartfile, add:
binary "GoogleMaps.json" ~> 3.1.0
Voila!

Was just about to find out how to improve upon Shai's answer. You can simply add
binary "https://googlemaps.github.io/google-maps-ios-utils/GoogleMapsSDK-iOS.json" ~> 3.8.0
into your Cartfile

I used Leone Parise github repo for google maps 2.7 https://github.com/leoneparise/GoogleMaps-Carthage
He has Google Places and Google Place Picker too, but not up to date. If you want to use those, I've them uploaded to 2.7 version here:
https://github.com/danitinez/GooglePlaces-Carthage
and here
https://github.com/danitinez/GooglePlacePicker-Carthage
Cheers!

Related

How to construct a Swift Package that links to a local (not system) library?

I must have read over a dozen posts on possible techniques to link a local library into my Swift Package. Specifically, my package depends on libturbojpeg.a, which most users won't have installed anywhere. Even if they did install it (there is a DMG), I'd have to go through hoops to make sure I was linking in the correct version. I finally found a post in the Swift Forums that basically says you can't do it now.
It appears that the only way to link it now is using .linkerSettings(LinkerSetting.unsafeFlags(..., but if you use that your package can't be managed by Xcode (see above link, and I even tried it and verified it cannot be used).
Is there some kind of workaround that allows me to distribute my Swift Package with the library?
In my Package, I created a directory "Libraries" and added my library there.
I discovered that Xcode 11 places included Swift Packages in a specific location in the Derived Folders directory. This means that it is possible to tell Xcode where to find it during the link phase.
My Package has these instructions in it for users:
1) Add the Package using Xcode->File->Packages with the URL of https://github.com/dhoerl/
2) Open the app's Project Build Phases, and from the Package shown in the left file pane, drag the Libraries/.a file into the link phase. It will appear just above the that should already be there
3) In Application Build settings, under library search paths, add:
"$(BUILD_DIR)/../../SourcePackages/checkouts//Libraries"
Build and run! Voíla - works like a charm!
Note: obviously this is somewhat fragile, Xcode 12 could change how packages are managed, but its possible by then that the Swift Package Manager will support linking of local libraries (its mentioned in the above link.)

How can I find a GitHub project from my podfile?

I have an iOS application.
I'm using CocoaPods.
I have a podfile with all my pods names.
I want to check changes made on one of the pods in GitHub, but I don't know how to get to my projects page.
How can I find the exact project from my podfile in GitHub?
For example -
One of the pods is GoogleAnalytics, searching "GoogleAnalytics" on GitHub will find multiple results with this exact name written by different developers.
How can I find the GoogleAnalytics from my podfile?
Writing the pod name on CocoaPods will get you to the specs but will not get you to the projects GitHub page.
See the source line in the podspec.
The GoogleAnalytics pod is a binary framework only and does not make its source available on GitHub.
Google analytics was just an example, but after #Paul Beusterien answer I understood that some companies sources may not be available on CocoaPods search, that made me search for the smaller independent developer pods, there I have found links to GitHub.
So the answer - if it helps anyone -
Search on CocoaPods for the links to GitHub, if you can't find it, it's probably big enough to find on google or on that dependency's website.

Integrating CocoaLumberjack into iOS Project via Drag-and-Drop

I'm trying to integrate CocoaLumberjack into my iOS project by dragging-and-dropping the Lumberjack.Xcode file into my project. That works fine, but now my project has 9 new targets. I don't need all of that overhead. So my question is, how do I cut down on the number of targets to just the needed stuff for iOS?
It seems every time I drag over only the mobile project that it is missing needed files. Upon my research, it seems that there are no up-to-date tutorials related to integrating Lumberjack specifically to iOS, which seems like a tool that would be commonly used so that is odd. Being new to all of this, it is troublesome and I would love some help.
Other information: I'm doing a manual installation since Cocoapods is not an option for me. I am following their Installation Guide:
Installation Guide
The very first line in the manual installation guide is
git submodule add git#github.com:CocoaLumberjack/CocoaLumberjack.git
I do not want to add yet another submodule to my project, so I'm dragging and dropping Lumberjack.Xcode into my project.
Before I learned how to use CocoaPods, I used to just clone the repo and copy all of the .h and .m files into my project, ensuring they're added to the correct target.
The only issue you have to make sure to avoid is missing one or more files. Not 100% sure with CocoaLumberjack, but I'd look at just adding everything from here:
https://github.com/CocoaLumberjack/CocoaLumberjack/tree/master/Classes
Instead of adding it as a submodule, you can simply clone the repo and add it to your project. The rest of the instructions remain the same. So replace the line you quoted above with:
git clone git#github.com:CocoaLumberjack/CocoaLumberjack.git
rm -r CocoaLumberjack/.git/
Then follow the rest of the instructions in the install guide.
Instructions from CocoaLumberJack
https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Documentation/GettingStarted.md

How to install projects without cocoa pods?

I have seen various libraries on GitHub that look useful, but only list CocoaPods as an install method. I'm not sure I want to be dependent on CocoaPods, because I'm wary of Apple breaking it in some future OS X/Xcode update. Is there a way to get these libraries into my Xcode project without using CocoaPods?
Role of CocoaPods is to automate and simplify the process, but you don't need to use CocoaPods if you don't want to.
In case of "manual installation", usually it would be:
download the project from GitHub
add the files to Xcode
import headers
But there is no universal recipe for every project, it may slightly differ from case to case, but usually it boils down to previously mentioned.
The best way if you don't want to use CocoaPods is to read the project documentation, and study examples if there are any.
Of course there is. Basically you need to download the library project, drag the project into your own project, do some library dependency setup and you're done.
For details, check out https://github.com/Alamofire/Alamofire for manually adding a Swift library. And https://github.com/jverkoey/ObjQREncoder for manually adding a Objective-C library to your project.
The only way to install things without Cocoapods is to just drag the source code of other projects into your class. For example, most Github projects can be installed via Cocoapods, or you can just drag the relevant source code into your projects. You don't need to drag in all of the project resources, all you need is usually class files

How to use cocoapods in an exist ios project

I have an ios project first made in Xcode4.6. I have update it to Xcode5.0.2. Now I want to change the project to using cocoapods to manage the third party pods.
Due to a newer to cocoapods.I search the Internet to how to install cocoapods and so on.Now it's OK.So I run the pod install to get "AFFnetworking 2.1.0". .xcworkspace generate successfully.Then I open the workspace.I saw this in the navigation
There are many question mark.I think this means that Xcode5.0.2 didn't know the AFNetworking 2.1.0 added by cocoapods. And If I write the "#import "AFNetworking.h" in a .m file. Xcode will say that can't find the "AFNetworking.h".
I am a newer to cocoapods. So home someone could help me. Tanks a lot.
Because AFNetworking is linked as a library you need to use the < > import style. So #import <AFNetworking/AFNetworking.h>.
The question marks are coming from your version-control system, not from Xcode itself; they indicate that the files added by CocoaPods are new to version control. I’d recommend committing all of the CocoaPods-related files right away so that you have just one commit that represents “moving to CocoaPods”.
I guess you are using git repository.Add files pod to repository, currently they are untracked thats the reason for '?' there.if the error persists then see the following discussion
AFNetworking Cause Error while using XCTest in Xcode5

Resources