0

I have two apps that are both open source, I am using Swift on iOS. I want to incorporate one into the other. The main App is a radio station, the second is a news feed. I want the news feed as a "sub project".

After a few days of Googling I have added the sub-project as advised on the following pages:

https://forums.developer.apple.com/thread/49659
https://curisious.com/the-correct-way-to-add-existing-project-to-workspace/

And I have tried to link the sub-project/framework as detailed here https://www.raywenderlich.com/126365/ios-frameworks-tutorial

I seem to have got the first bit sorted, I have the newsfeed as a dependency to the radio player, but I am struggling to open the dependency. I have created a button named NewsButton with the following IBAction:

    @IBAction func NewsButton(_ sender: UIButton) {

    }

But I just can't get the button to go to the dependent project.

I have tested it with this code:

    @IBAction func NewsButton(_ sender: UIButton) {
    print("Butten clicked")
    let button = UIButton()
    self.NewsButton(button)        
    }

Which does what I would expect it to do, but I want it to open the dependent app.

I know there is no code in this, I have tried several suggestions but these come up with critical errors. I have tried creating a class but still comes up with nothing.

I have also tried to follow the instructions here https://stackoverflow.com/questions/33932303/swift-how-to-open-a-new-app-when-uibutton-is-tapped

Modifying the "sub-project" to CheekyNews in the info.plist and having the following code:

    @IBAction func NewsButton(_ sender: UIButton) {
    if let url = URL(string: "CheekyNews://") {
            UIApplication.shared.openURL(url)
            }
    }

The button appears to be doing something, but not opening the news feed

1
Contributor
0
Replies
11
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.