**実現したいこと**

外部ライブラリの"PageMenuKit"  
<https://github.com/magickworx/PageMenuKitSwift>

を導入しようと試みています。

**やってみたこと**

１．上記のリンクから"PageMenuKit"をダウンロードし、  
PageMenuKitSwift.xcodeprojをXcodeで開き、"PageMenuKitFatBinary"を指定し、Buildを実行。

２．"PageMenuKit.framework"が生成されたので、これをFinder上で"PageMenuKit"を導入したいプロジェクトのフォルダの中の.xcodeprojがあるのと同じ階層に移動。

３．"PageMenuKit"を導入したいプロジェクトの.xcodeprojをXcodeで開き、Embedded
Binariesから"PageMenuKit.framework"を追加し、  
上記リンクの"How to use
PageMenuKit.framework"の部分に従って、"PageMenuKitDemo"内と同じように以下のコードを記述。

```

    import UIKit
    import PageMenuKit
    
    class RootViewController: BaseViewController
    {
        var pageMenuController: PMKPageMenuController? = nil
    
        override func setup() {
            super.setup()
    
            self.title = "PageMenuKit Frameworks"
        }
    
        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }
    
        override func loadView() {
            super.loadView()
        }
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            var controllers: [UIViewController] = []
            let dateFormatter = DateFormatter()
            for month in dateFormatter.monthSymbols {
                let viewController: DataViewController = DataViewController()
                viewController.title = month
                controllers.append(viewController)
            }
    
            let statusBarHeight: CGFloat = UIApplication.shared.statusBarFrame.size.height
            /*
             * Available menuStyles:
             * .plain, .tab, .smart, .hacka, .ellipse, .web, .suite, .netlab, .nhk
             * See PMKPageMenuItem.swift in PageMenuKit folder.
             * "menuColors: []" means that we will use the default colors.
             * "startIndex" can be set 1...controllers.count.
             */
            pageMenuController = PMKPageMenuController(controllers: controllers, menuStyle: .smart, menuColors: [], startIndex: 1, topBarHeight: statusBarHeight)
            //    pageMenuController = PMKPageMenuController(controllers: controllers, menuStyle: .plain, menuColors: [.purple], startIndex: 8, topBarHeight: statusBarHeight)
            pageMenuController?.delegate = self
            self.addChild(pageMenuController!)
            self.view.addSubview(pageMenuController!.view)
            pageMenuController?.didMove(toParent: self)
        }
    
        override func viewWillAppear(_ animated: Bool) {
            super.viewWillAppear(animated)
    
            self.navigationController?.navigationBar.isHidden = false
        }
    }
    
    extension RootViewController: PMKPageMenuControllerDelegate
    {
        func pageMenuController(_ pageMenuController: PMKPageMenuController, willMoveTo viewController: UIViewController, at menuIndex: Int) {
        }
    
        func pageMenuController(_ pageMenuController: PMKPageMenuController, didMoveTo viewController: UIViewController, at menuIndex: Int) {
        }
    
        func pageMenuController(_ pageMenuController: PMKPageMenuController, didPrepare menuItems: [PMKPageMenuItem]) {
            // XXX: For .hacka style
            var i: Int = 1
            for item: PMKPageMenuItem in menuItems {
                item.badgeValue = String(format: "%zd", i)
                i += 1
            }
        }
    
        func pageMenuController(_ pageMenuController: PMKPageMenuController, didSelect menuItem: PMKPageMenuItem, at menuIndex: Int) {
            menuItem.badgeValue = nil // XXX: For .hacka style
        }
    }
    
```

```

    import UIKit
    
    class BaseViewController: UIViewController
    {
      required init(coder aDecoder: NSCoder) {
        fatalError("NSCoding not supported")
      }
    
      init() {
        super.init(nibName: nil, bundle: nil)
        setup()
      }
    
      override func loadView() {
        super.loadView()
    
        self.edgesForExtendedLayout = []
        self.extendedLayoutIncludesOpaqueBars = true
    
        self.view.backgroundColor = .white
        self.view.autoresizesSubviews = true
        self.view.autoresizingMask  = [ .flexibleWidth, .flexibleHeight ]
      }
    
      func setup() {
        // actual contents of init(). subclass can override this.
      }
    
      override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
      }
    
      override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
      }
    }
    
```

```

    import UIKit
    
    class DataViewController: BaseViewController
    {
      public private(set) var textLabel: UILabel? = nil
    
      override func setup() {
        super.setup()
    
        self.title = "Demo"
      }
    
      override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
      }
    
      override func loadView() {
        super.loadView()
    
        let label = UILabel(frame: self.view.bounds)
        label.backgroundColor = UIColor.hexColor(0xccccff)
        label.font = UIFont.systemFont(ofSize: 64.0)
        label.textAlignment = .center
        label.adjustsFontSizeToFitWidth = true
        self.view.addSubview(label)
        self.textLabel = label
      }
    
      override func viewDidLoad() {
        super.viewDidLoad()
      }
    
      override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
    
        self.textLabel?.text = self.title
    
        self.navigationController?.navigationBar.isHidden = true
      }
    
      override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
      }
    }
    
```

```

    import UIKit
    
    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate
    {
      open private(set) var themeColor: UIColor? = nil
    
      var window: UIWindow?
    
      override init() {
        super.init()
      }
    
      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        // Create full-screen window
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window!.backgroundColor = .white
    
        // Make root view controller
        self.window!.rootViewController = RootViewController()
    
        // Show window
        self.window!.makeKeyAndVisible()
    
        return true
      }
    
      func applicationWillResignActive(_ application: UIApplication) {
        /*
         * Sent when the application is about to move from active to inactive state.
         * This can occur for certain types of temporary interruptions (such as an
         * incoming phone call or SMS message) or when the user quits
         * the application and it begins the transition to the background state.
         * Use this method to pause ongoing tasks, disable timers, and invalidate
         * graphics rendering callbacks. Games should use this method to pause
         * the game.
         */
      }
    
      func applicationDidEnterBackground(_ application: UIApplication) {
        /*
         * Use this method to release shared resources, save user data,
         * invalidate timers, and store enough application state information
         * to restore your application to its current state in case it is
         * terminated later.
         * If your application supports background execution, this method is called
         * instead of applicationWillTerminate: when the user quits.
         */
      }
    
      func applicationWillEnterForeground(_ application: UIApplication) {
        /*
         * Called as part of the transition from the background to the active state;
         * here you can undo many of the changes made on entering the background.
         */
      }
    
      func applicationDidBecomeActive(_ application: UIApplication) {
        /*
         * Restart any tasks that were paused (or not yet started)
         * while the application was inactive. If the application was previously
         * in the background, optionally refresh the user interface.
         */
      }
    
      func applicationWillTerminate(_ application: UIApplication) {
        /*
         * Called when the application is about to terminate.
         * Save data if appropriate. See also applicationDidEnterBackground:.
         */
      }
    }
    
```

**発生している問題**

上記の手順を踏んだ後に、ビルドすると、特にエラーが出ることもなく、  
Build Succededと表示されてシュミレーターも起動しますが、真っ白な画面が表示されるだけでうまく導入できていないようです。

うまくいけば、  
[![画像の説明をここに入力](https://i.stack.imgur.com/26vbd.png)](https://i.stack.imgur.com/26vbd.png)  
こんな感じになるはずなのですが…。

ちなみに"PageMenuKit"を導入したいプロジェクトのナビゲーターはこんな感じになっています。  
[![画像の説明をここに入力](https://i.stack.imgur.com/aExES.png)](https://i.stack.imgur.com/aExES.png)

storyboardはこんな感じです。  
[![画像の説明をここに入力](https://i.stack.imgur.com/pxoQ6.jpg)](https://i.stack.imgur.com/pxoQ6.jpg)

どなたか解決策を教えていただけると幸いです。
CC BY-SA 4.0
2019-08-24T05:01:53.837
57573
2019-08-24T06:52:26.050
2019-08-24T06:52:26.050
3060
35561
question
swift xcode framework
外部ライブラリ"PageMenuKit"のframeworkをimportしてビルドしても画面が真っ白で何も表示されない