I created a private cocoapod framework and distributed it.Now i am able to download it via pods. But upon pod install all files and it's implementation is present. I want to hide the files or its implementation. Is there any way to do ? When i add s.exclude_files to hide certain files, its shows error with pod spec lint command stating s.source_files not able to access the files added in s.exclude_files.
I only want certain files to be accessible and other file's implementation should be hidden.
Related
I've been developing iOS apps for about 18 months now, and I am mostly self-taught. I was recently hired and brought onto a very large project with a lot of moving pieces. I'd like to provide a broad outline for the owner of the application who hired me and I also want to do a security check before presenting the outline to him and others, as well as suggest to him that we should ultimately hire an iOS security expert.
Moreover, after a brief overview of the project, I’ve found a few things that stick out to me and I was wondering if they also stick out to anyone viewing this post:
Below the main project file, there is a Xcode project file, named: 'Pods'
Project - Pods
Podfile:
(Lists all pods); will do a separate post for specifics on this).
Frameworks:
(Contains all frameworks from cocoa pods we use).
Pods:
(Contains many folders, each named after each cocoa pods pod we use).
Products:
(List all of the cocoa pods we use, followed by a .framework after each).
Ex: 'Alamofire.framework'
Targets Support Files:
Contains two folders:
1. Pods-UberApp-Uber
2. Pods-UberApp-UberDev
In each of the two folders within 'Targets Support Files' the following files exist (image link below), with the beginning (for the first set of items within the first file) being 'Pods-UberApp-Uber' or (for the second set of items within the second file) 'Pods-UberApp-UberDev':
Screenshot of 'Pods-UberApp-Uber' / 'Pods-UberApp-UberDev' file items, previously described
What are these files and are they present for every Xcode project/iOS app?
Note: Uber is just the demo name of the app for sake of privacy and understanding. Thx.
These files are autogenerated by cocoapods
The only file that you may edit in Pods project, is Podfile. It contains all your dependencies, and may contain some custom settings for configuring them.
If you open Podfile location in the file system, you'll find Podfile.lock nearby: it contains all versions for installed dependencies since the last pod install or pod update. You can try removing Pods folder and run pod install from terminal inside folder with Podfile, it should recreate the Pods directory.
So all these files on your screenshot are just needed by Xcode to build dependencies for you.
I am little confused whether cocoa pods increase the size of our project or not. Although there is other many benefits of using cocoa pods.
I have search but they only said it will increase size only when you copy the repo.What happens if i will not increase the repo
CocoaPods keeps the external library files separate from your own source code.
If you mean “project” to be the actual .xcodeproj file and files it references, then no. It will not add to that size. (Other than changing some configuration options)
If you mean “project” to be all files associated with your app, then yes. Any package manager will do that because it’s downloading external files.
However, you can choose to not put CocoaPods’ files in source control (e.g. Git).
You can do one of two things:
Put all files into source control. This increases the size of your repo, but no one else needs to run pod install.
Put only the Podfile.lock into source control. This will make your repo smaller, but every time you clone the repo, you must have CocoaPods installed and run pod install.
What is the best approach to access project source files (.h/.m or Assets.xcassets) under podfile. I'm using a library and want to access my source files in my project. I don't want to hard code anything because I'm using some globally defined parameters.
- I guess podspec is one option (not sure), but I don't want to call pod update each time I made a change in podfile.
See attached image:
If you are using those classes in a single project, then there is no advantage in putting them in a separate pod. If they are used in multiple projects and are rarely modified, then you can consider creating a private Pod. In that case, however, you will need to call pod update every time you release a new build to your private pod.
I have a private cocoapod to share common models and controllers at our company. There is a config file that needs to be included because it
is referenced in the Cocoapod file. For example, if we have:
sample-proj/Pods/OurClasses/Classes/MyViewController.m
which has
#import "ABCConfig.h"
and ABCConfig is in sample-proj, how would I tell it to include it correctly? We have a project for which this works correctly and I thought
it would adding $(SRCROOT) in Search Paths -> User Header Search Paths but this doesn't seem to do it (although this could be some wierd Xcode artefact).
I can infer the problem as specifying a set of config to the libarary/framework. You should rethink of how you set a config and `import "ABCConfig.h" is right or not. There are couple of options,
Modify config file after you do pod install (this will be lost with next pod install),
use different config as submodule and import corresponding module when installing pods
Expose an API to feed in the configuration to library (best approach - flexible for user to tweak and give their configuration).
Added a new class and methods to the existing code in an imported pod.
I checked everything I could in the Utilities for this new class.
Location of .h and .m file is selected as 'Relative to project' like all other files in this pod
actual files are in the same path as the other file of this pod
target membership is same as pod.
Xcode is not seeing the addition of the new class (h file in an import statement in the project using the pod).
Not sure why it doesn’t work for you, but aside from that you should not modify the Pods.xcodeproj. CocoaPods assumes it has control over it and will wipe out your changes on the next pod install or pod update. (Maybe that’s the problem your seeing?)
Either add the custom class to your own project, extend the library with categories in your own project, or have a fork of the library where you push your changes to (possibly by using the :local directive in your Podfile).