How would I go about adding libraries to iOS app - swift

Im brand new to iOS development, and Im in a conundrum. I need to add an iOS library from Github into my project to use. However, it does not support Carthage or CocoaPods.
I have tried dragging and dropping the source files into my project, but have had no luck. Ive even tried dragging the entire 'Source' folder into the project, but with the same results.The most common error occurs when I have added the files into my file structure like so:
The error is: Cannot find MathExprParser in scope.
The link to the Git repo is this: https://github.com/softyde/MathExprParser.
I don't really know what Im doing in this respect, Im used to using CocoaPods and Cartfile...
Note Parser.swift, Scanner.swift, and String+Char.swift are the files in question.
EXPRTESTING is my main project, not part of a workspace.

This was unfortunately, an act of stupidity... =(
According to the repo, you have to copy and past some items into the project structure. I copied the entire folder MathExprParser into my project.
Now, I had tried this before, but I was hung up on trying to import the MathExprParser module.
I realized that since the classes I needed to use were physically inside the project, I didn't need to import it, or use MathExprParser.Parse. I could use just Parse().

Related

I'm trying to learn c# using some unity classes but I'm having some problems

I'm taking a class on making 2d games in unity, but unity won't open the game file. The error message is: Project path does not exist C:\users\Ohy0y\oneDrive\unity\NewUnityProject. Please note that the unity folder is not official, it is made by me. I have updated unity, deleted every previous version of unity, and tried to redirect the path into an empty folder.
This is my first day learning unity so I may be missing something obvious, please answer if possible!
A "game file" does not exist in Unity. In Unity, you have a specific folder structure. The project folder is the folder your Assets, ProjectSettings, Packages,... folder is inside.
In Unity Hub, remove the project you are trying to open from the list of projects and add it again by chosing your project folder (the one containing the Asset folder and such).
If that doesn't work for you, please specify why and try the following step:
In your project folder go into the ProjectSettings folder and open the file "ProjectVersion.txt" and tell me what the first line sais (m_EditorVersion: xxx). This is the project version, i.e. what Unity Version was used to create the project. That version should match the Untiy version you have installed.
Also, gernerally speaking, Unity Answers is the better platform for you to get quick answers to simple Unity related questions.
If you want to run your Game (Game File), you need to create a build first.
But of course you need to build a working scene first. If you have problems just opening the project with unity, i would try making a new project outside onedrive.

Project looking for own DLL in another project

I'm currently trying to move a solution with multiple projects from VS 2015 to VS 2019.It consists of one application and a couple of class libraries, target framework for each is .net 4.5.1. I have made a local copy of the solution to do this.
Most of the projects compile without a problem, but some of the one that are used as AddIns for the application don't.
When trying to build, doesn't matter if the projects by themselves or the whole solution, it fails because it's looking for itself. In my example picture, the project ZZ_WPF_Bank_AddIn is, while trying to build, is looking for the ZZ_WPF_Bank_AddIn in the bin folder of another project in the solution.
I tried just copying the dll from the original project, to see what happens, but it just points to the same dll missing in another project.
Has someone encountered this behaviour before? I tried googling it, but couldn't find anything useful.enter image description here
For anyone who might stumble upon this:
The solution to my problem was removing all references to projects inside the solution and adding them via Browse, noch via the projects tab on the left side. For some reason the bindings were not working properly after the migration.

With Xcode 4, what is the proper way have a main project + a shared code project?

Currently I have an iPhone app that is just one large project. It has hundreds of code files. I have one folder called "Helper" that includes all of my classes that I have created. I'm going to be making a second app that also needs to use the exact same code that is in the "Helper" folder.
What is the proper way to share that "Helper" code between two projects/apps? Should I put it in its own project file and then add both the main app + "Helper" to a common workspace? I'm not interested in making static libraries or anything... I just want the code segregated somehow.
I've already tried making a second "blank" project file and dragging the code into it, but when I try to build Xcode just thinks I am missing header files now... for some reason it's not seeing the code in the other project.
It would be ideal if there were a clean distinction between the shared code and the code unique to your current app. If there isn't yet, try to make sure everything that will be shared is not dependent on anything from the code unique to the project.
One way you could accomplish this is by using a Git Repo and then making the shared code its own repo project. Then, in the repo for both projects, include the helper code as a submodule.
I've worked with projects that use submodules, though I haven't set up the submodule aspect myself as of yet. The benefit here is that any changes you make to "helper" can be pulled into the both projects, so the changes are synchronized.
If you aren't familiar with Git yet, I recommend getting familiar. Setting up a Git repo on your computer, even if you aren't collaborating with others, is pretty useful. XCode currently offers the option of setting up a repo when you create your project. If you haven't done that, or aren't sure though, you can still create a repo after the fact.
I use source tree to manage my repositories. Creating a repo is pretty straightforward and easy from there SourceTree. However, you can use GitHub's own desktop client, or any other client if you wish - depending on how you set up your project.
Some information about setting up a submodule in git: Setting up a submodule
So, to recap:
Make sure your "helper" code can stand on its own
Put the helper code into its own repo
Include the helper repo as a submodule to any project you want the code in.
Hope that helps!
It sounds to me the situation you have described is exactly what a framework is designed to solve. What you would likely end up doing is creating another project with all of your shared code within it and creating a framework which your applications could link against.
I would suggest reading Apple's Framework Programming Guide. From the introduction to the guide:
Mac OS X makes extensive use of frameworks to distribute shared code and resources, such as the interfaces to the system itself. You can create frameworks of your own to provide shared code and resources to one or more of your company’s applications. You can also create frameworks containing class libraries or add-on modules with the intention of distributing them to other developers.
You can put the shared code in a separate folder and then add it to the both projects.
But don't forget to add the path of the folder to the User Header Search Paths in Build Settings > Search Paths.
I'm not interested in making static libraries or anything...
Yet, for iOS, a static library target is exactly what you'd use.
No workspace required, just a separate Xcode project with that shared static library, which both apps reference.

How do you add a resource to a .bundle/wrapper.plug-in?

Sorry for the n00b question, but I have no more hair to pull. =(
I'm building my iOS project using XCode and have a reference to another XCode project, to make this work I also need to reference the bundle-file. The developer who built the project and bundle wanted to organize things and thus put all the images inside of this .bundle-file.
Now my question is this:
How do you add a file/resource to a .bundle file? -> http://grab.by/7p3Y
The file type of the bundle is: wrapper.plug-in -> http://grab.by/7p3W
The files I add by right-clicking and selecting add existing files all end up in the project not in the bundle resource.
Any kind of help will be most appreciated! Also an indication if this is common or a custom solution?
Best regards
Abeansits
Update:
As usual the problem was me, I'm blaming this on low sugar levels. =(
All you need to do is add a file to the bundle manually and it will show up in XCode.
As I wrote in the question, the solution is really simple. Just add the files you need inside the project to the bundle. Since the bundle is actually a folder, you can right click it an select show content. Anything you later add to the folder will show up in the project.
I guess this confused me since usually when you add resources to your project you need to do this through XCode.

Add external project to my iphone app in xcode

Just starting to poke around iPhone development. I am trying to add an external project/library to mine (specifically the ASIHTTPRequest, http://allseeing-i.com/ASIHTTPRequest/).
I am at a bit of a loss as to how I go about actually adding this dependency to my project. I come from a Visual Studio/C# world, and in Visual Studio I know I would "Add Existing Project" to my solution file and then add a reference to the new project to my own. Or, alternatively, reference the DLL directly if it is already built.
The ASIHttpRequest project is on GitHub, and provides full source code. I just don't have any idea about how to actually get this dependency into my own project. I tried "Project -> Add To Project", and just selected the folder ASIHTTPRequest extracted out into. I see it as a sub-folder to my project now... but get a ton of build errors. I removed everything but the .h and .m files from this subfolder, and now I don't get any build errors from those resources anymore, but trying to reference a ASIHTTPRequest object in my own project gives "undeclared" errors.
Am I missing something here? Can I not of these .h and .m files in subfolders?
You're on the right track. You just need to #import the ASIHTTPRequest header in the file where you want to use it. You do have to make sure you've met all the dependencies specified on the ASI site, but once you've done that, everything should work right by just doing an import like you've described. Once all that is set and everything is compiled, add this:
#import "ASIHTTPRequest.h"
to the top of the file where you want to use the library.