tungvoduc / DTPagerController

A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.
MIT License
289 stars 42 forks source link

Cannot find type 'UIViewController' in scope #54

Closed multitudes closed 3 years ago

multitudes commented 3 years ago

I removed the old version from the pod and installed DTPagerController with SPM. The code is the same strangely , but after installing it with Swift Package Manager it does not compile.

And of course it says it cannot find it in scope, maybe because UIViewController is UIKit after all ? ;)

Here is the code giving problems:

import Foundation

public extension UIViewController {
    var pagerController: DTPagerController? {
        get {
            var viewController = parent

            while viewController != nil {
                if let containerViewController = viewController as? DTPagerController {
                    return containerViewController
                }
                viewController = viewController?.parent
            }

            return nil
        }
    }
}

and the screenshot.

Too bad I would really like to use SPM but it will have to wait I guess?

Screenshot 2021-03-25 at 17 00 42

Ded77 commented 3 years ago

Hello, same problem for me :( The UIKit import seems missing.

Ded77 commented 3 years ago

Strange, It should be fixed by https://github.com/tungvoduc/DTPagerController/commit/522ce1089d13ff862c352f0d5ba2d1ae5a7b63a0

Ded77 commented 3 years ago

Ok, the last version of the library does not include this fix. We have to pick the master branch to SPM @multitudes.

Ded77 commented 3 years ago

Hello @tungvoduc, thanks for your library ! Is it possible to tag a new version with the SPM fix ? Thank you

tungvoduc commented 3 years ago

@Ded77 Sorry for late reply. I'll get it done today.

tungvoduc commented 3 years ago

@multitudes @Ded77 Should be fixed now guys!

multitudes commented 3 years ago

Thank you!

Ded77 commented 3 years ago

Great, thank you!

Rutvik2699 commented 2 years ago

import UIKit would fix it!