Can i open an Xcode project on a button click from another project without custom URL schema? - ios

I want to integrate two Xcode projects together and they both are full Xcode projects with UI and all. For example lets say i have an App 'A' which has a UIButton and on click it should open App 'B' which has its own UI.
I know we can open an App from another App through Custom URL schema but is there a way i can do this without custom URL schema and via connecting Xcode projects.
I know this a little vague question but i don't a better way to put this.
Thanks,

You're question doesn't make any sense. You're talking about two very different things. Yes, you may import one Xcode project into another Xcode project and setup a dependency between them. However, this in no way affects how the apps work with each other. If you're wanting to embed one app inside another, you have to do it at the view controller/code level. You cannot simply add one project to another and expect the two to intercommunicate. You'll have to move the functionality of one app to another. Apps are sandboxed on the device and can therefore have no communication with each other except for by using custom URL schemes as you've mentioned.

Related

What is the difference between an "app" project and a "framework" project in Xcode?

I am working on a project with SwiftUI and it originally started with creating a new project as an "App" (Xcode, clicked on file, new, project, click on "App") but was then later asked to put it into a pod as a framework. I did it successfully (Xcode, clicked on file, new project, click on "Framework"), however I am unsure what the differences are and I'm unsure why I would want to do that. To me they look very similar, except that I'm unable to launch my project as a framework in the simulator. Luckily SwiftUI offers the canvas preview window however it is a bit finicky when it comes to certain button interactions, which is why I am wanting to use the simulator.
Two places of confusion:
What is the difference between an app and a framework project?
Why is it more advantageous to have my project as a framework?
An App is a standalone application that can be launched and run. For example, all of the apps that you have on your phone are just that -- apps. You tap on them and they launch and run, presenting a user interface, accepting input, etc.
A framework is something else entirely. It's a collection of code that is bundled together into a package that is used by another framework or by an app. Some frameworks are provided by the system -- for example, SwiftUI is a framework that it sounds like you're using in your app. Other frameworks are provided by 3rd parties. For example, you can find many frameworks via CocoaPods or the Swift Package Manager -- Alamofire is a common example. Also, you can make your own frameworks and use them in your own code as a form of organization and separation of responsibilities.
Why is it more advantageous to have my project as a framework?
It is not -- they are two almost completely different concepts (besides both ultimately being collections of code and resources). If you intend to build an app that is launch-able on someone's device, your only choice is to make an app. If you intend to make a collection of reusable code for use in your or someone else's app, than you would make a framework.
Excellent answer (and upvoted) by #jnpdx. Let me give you a physical example:
(1) Create a project in Xcode that is a framework. Call it "MyAppKit". Inside it create, well, basically anything - a View, UIView, or more likely a function that will be shared by several views. (Let's go with that.)
public func setLoginName(_ login:String) -> String {
return ""Hello, " + login + "!";
}
Pretty simple. Call it, pass in something, and it returns a string saying hello. Please note the public piece. It matters. (And there's much more there. This is a simple example.)
(2) Now we get to your app or apps. Let's say you have two apps that need to use this (again, very simple) code. One is SwiftUI, one is UIKit. (It doesn't matter except for syntax.) Sine my forte is UIKit I'll use that. (And it can be several dozen apps too.)
import MyAppKit
let myLoginMessage = setLoginName("World").
Pretty much, it's "Hello, World!'
Again, this is really a nonsensical example. But it should get you started on what the difference in Xcode is between a Framework project and an App project is.

Is there any possibility to add Sub-project to current Project?

Can anyone suggest me like:
I had done one project by using Objective-C. And I had an requirement to keep one button and If any user tap on that and it needs to open "https://github.com/Block-Equity/stellar-ios-wallet" (Swift) inside my app.
If user want to come back to Parent app from Sub-Project.. He can..
How can I keep 2 separate projects in One project and need to operate two projects while run-time?

swift how to embed one app to another

I am intern student who working mobile applications on swift. I created an app for company and I need to embed my app to other partner firm's app. I look some solutions on stackoverflow but they were not clear, Should I use target file? How to embed one app to another app?
Thanks for all help!!
Embedding one app to another isn't quiet right definition. What you are looking for is a Dynamic Framework. You can add a new Dynamic Framework target to your partner's app and move all the functionality and resources you need from your app.
https://developer.apple.com/library/content/technotes/tn2435/_index.html
A framework is a hierarchical directory that encapsulates a dynamic library, header files, and resources, such as storyboards, image files, and localized strings, into a single package. Apps using frameworks need to embed the framework in the app's bundle.
In case if you only want to allow the user to navigate from one app to another, you should use iOS Deep Linking mechanism. There are many third party, ready to use solutions for that, like Branch.
https://branch.io/
This can be usefull as well:
https://developer.apple.com/ios/universal-links/
This can be accomplished by defining a URL schema for your app so that the partner's app can point to.
Here is a tutorial that you need
http://www.brianjcoleman.com/tutorial-deep-linking-in-swift/

Make multiple replica of single ios app

I have 10 ios apps which have same UI and almost same functionality except minor changes.
I have completed one app and want to make other 9 app and also used some 3rd party libraries and made changes to them and made some my custom functions for app functionality.
My concern is that if i will get change for even one functionality , i have to make that change to other 9 apps.
What is the the best and fastest way except changing code in each file ?
You should keep one codebase and add multiple targets to it.
This way you can write both target specific code, and generic code.
You can read up more on this here One Codebase Multiple Targets
and here Apple Xcode Targets
Hope it helps

How to make framework (library?) for personal re-use in iOS?

I'm doing a series of book apps for a client. There's a lot of books in the series, and each one will be a separate app. Instead of making changes to all the apps every time they want something tweaked in all of them, like the position of a button or something, I'd like to make a universal "framework" (library?) that I can import to a project, just as I would do for one of the iOS SDK's frameworks. The framework would have all the universal components of the apps, which would include a controller class I would subclass in each app to do the app-specific things. Then when I need to make changes to all of them, I could just change the code in the framework, and it would affect all the apps that use it. I'd also like to be able to include common images and other media.
Do I want to use the "Cocoa Touch Static Library" template in Xcode? I also saw this project in github: https://github.com/kstenerud/iOS-Universal-Framework; would this be a better fit for what I'm trying to do?
For your purposes, the simplest approach would simply be to set it up as a static library project. Then, for each application you want to use it, drag the project into your workspace and add the static library product as a dependent target.
As far as I am aware, the current leading method for building a framework on iOS is Jeff Verkoeyen's iOS-Framework.

Resources