Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when initializing from code #12

Closed
gintechsystems opened this issue Mar 30, 2020 · 2 comments
Closed

Error when initializing from code #12

gintechsystems opened this issue Mar 30, 2020 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@gintechsystems
Copy link

gintechsystems commented Mar 30, 2020

Hello,

I have implemented your library using CocoaPods using Xcode 11.4. I am testing on the simulator with iOS 13.4.

I am trying to use your library from code without storyboard at all but it doesn't seem to be working. I am not sure if it is because I am trying to add the menu to a table view cell, but no matter what I do I get a white empty box on the UI side of things and when I am debugging I always see this:

expression produced error: error: /var/folders/1w/ltx7q76130s12wkrq5_tjdxm0000gp/T/expr56-31d3d2..swift:1:88: error: 'SwiftyMenuDisplayable' is not a member type of 'SwiftyMenu'
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Swift.Array<SwiftyMenu.SwiftyMenuDisplayable>>(bitPattern: 0x1090356e0)!.pointee)
                                                                            ~~~~~~~~~~ ^

SwiftyMenu.SwiftyMenu:1:20: note: 'SwiftyMenu' declared here
final public class SwiftyMenu : UIView {

Clicking any menu crashes the application:

Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file Pods/SwiftyMenu/SwiftyMenu/Classes/SwiftyMenu.swift, line 470
2020-03-30 11:01:34.684213-0400 ARC Bookshelf[22331:3996509] Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file Pods/SwiftyMenu/SwiftyMenu/Classes/SwiftyMenu.swift, line 470

Some of my code on how I am implementing the menu:

class DropdownMenuCellView: MenuCellView, SwiftyMenuDelegate {
    
    var dropdownMenu: SwiftyMenu?
    var icon: UIImageView?

    private let alphaNormal: CGFloat = 0.0
    private let alphaSelected: CGFloat = 1.0
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        dropdownMenu = SwiftyMenu(frame: CGRect(x: 10.0, y: 0.0, width: self.frame.width - 10.0, height: 30.0))
        dropdownMenu?.delegate = self
        
        dropdownMenu?.isMultiSelect = false
        //dropdownMenu?.scrollingEnabled = false
        
        dropdownMenu?.rowBackgroundColor = .menuBackground
        
        dropdownMenu?.cornerRadius = 0.0
        
        self.addSubview(dropdownMenu!)
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    func swiftyMenu(_ swiftyMenu: SwiftyMenu, didSelectItem item: SwiftyMenuDisplayable, atIndex index: Int) {
        // TODO
    }
    
}

At quick glance I believe this is related to it being implemented through CocoaPods, since it seems to act as if the module is missing. I am using !use_frameworks in my Podfile. I am not sure if your library does not work in that scenario.

@KarimEbrahemAbdelaziz KarimEbrahemAbdelaziz added the enhancement New feature or request label May 23, 2021
@KarimEbrahemAbdelaziz KarimEbrahemAbdelaziz self-assigned this May 23, 2021
@KarimEbrahemAbdelaziz KarimEbrahemAbdelaziz added the bug Something isn't working label May 23, 2021
@KarimEbrahemAbdelaziz
Copy link
Owner

Hi @gintechsystems ,

Thank you for reporting this issue.
I will start working on this ASAP.

@KarimEbrahemAbdelaziz
Copy link
Owner

The coming version I'll provide an example for this use case.
Thanks @gintechsystems :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants