Initializer for conditional binding must have Optional type, not 'NSNumber' in swift3 code executing in xcode10 :  getting error in below code  - 

    Initializer for conditional binding must have Optional type, not 'NSNumber'





    if let MId = (M as AnyObject).gid {
                        if let id = MId {
                            fetchvalue(id, limit: limit, delegate: delegate)
                        }
                    }



please help me