Skip to content

Latest commit

 

History

History
106 lines (81 loc) · 4.05 KB

README.md

File metadata and controls

106 lines (81 loc) · 4.05 KB

AppsPortfolio

iOS Swift Package Manager Twitter: @mahmudahsan

To showcase multiple apps of a developer for cross promotion. Its an offline way to show user about other apps and it's also possible to know which app users are having more interest. I have been using this UI in all of my iOS apps for cross promoting my other apps. This is a complete project but any improvements are welcome.

In plist data, if there is only one category mention for example games, then the segmented tab at top will not be shown. To show segmented tab with categories you must have to provide at least 2 categories of apps. Please check the plist file structure to know how to provide app list.

Apps Portfolio

Features

  • Showcase apps for cross promotion
  • Delegate to integrate analytics to see which app user visits in app store
  • Works in both iPhone and iPad

Examples

Integrate within a UIViewController:

let bundle = Bundle(for: AppsPortfolioViewController.self)
let storyboard = UIStoryboard(name: "AppsPortfolio", bundle: bundle)
        
let appsPortfolioVC = storyboard.instantiateInitialViewController() as! AppsPortfolioViewController
appsPortfolioVC.title     = "Portfolio"
appsPortfolioVC.loadAppList(name: "sample_portfolio")
self.navigationController?.pushViewController(appsPortfolioVC, animated: true)

Add a custom back button to top left if by default navigation bar is hidden:

let backButton = UIButton(frame: CGRect(x: 10, y: 7, width: 74, height: 30))
backButton.setImage(UIImage(named: "btnBack"), for: UIControlState.normal)
backButton.addTarget(self, action: #selector(goBackFromPortfolio), for: UIControlEvents.touchUpInside)
appsPortfolioVC.view.addSubview(backButton)
@objc private func goBackFromPortfolio(){
    self.navigationController?.popViewController(animated: true)
}

Apps Portfolio

Implement delegate to inform when user tap an app:

let bundle = Bundle(for: AppsPortfolioViewController.self)
let storyboard = UIStoryboard(name: "AppsPortfolio", bundle: bundle)
        
let appsPortfolioVC = storyboard.instantiateInitialViewController() as! AppsPortfolioViewController
appsPortfolioVC.title     = "Portfolio"

//assigning analytics delegates
appsPortfolioVC.setAnalyticsDelegate(any: self) 

appsPortfolioVC.loadAppList(name: "sample_portfolio")
self.navigationController?.pushViewController(appsPortfolioVC, animated: true)

One delegate method need to implement to know user interaction:

extension ViewController : AppsPortfolio.Analytics{
    func appClicked(appNamed: String) {
        print("App: \(appNamed) clicked.")
    }
}

sample_portfolio.plist file structure:

plist flie stucture

How to use

Add this Swift package to your project

https://github.com/mahmudahsan/AppsPortfolio
  • In your project create a new apps_portfolio.plist file and provide your apps list. Follow the sample_portfolio.plist file format provided in AppsPortfolio/Data.

  • In your project add the icons of your cross promoting apps and mention them in your plist file. Better use Images.assets to add apps's icons.

Images

Questions or feedback?

Feel free to open an issue, or find me @mahmudahsan on Twitter.