So I have a function that checks wether the user is viewing their profile or not. and here is my function.

```
func isUserViewCurrentUser() -> Bool {
    guard let user = userDataDelegate?.userData() else {
        return false
    }

    if user == Current.user {
        print("returning false: USER IS CURRENT USER")
        return false
    } else {
        print("returning true: USER IS NOT CURRENT USER")
        return true
    }

 }

```

Then I only run my function in the view will appear, the code supposed to stop after I print something:

```
override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(true)
    if isUserViewCurrentUser() == true {
        self.navigationItem.rightBarButtonItem = nil
        self.navigationItem.leftBarButtonItem = nil
        return
    } else {
        return
    }

    if let userID = userDataDelegate?.userData().userID {
        retrieveFollowerNumbers(userIdentifier: userID)
        return
    }

 }

```

But my console printed "returning true: USER IS NOT CURRENT USER" for a thousand times and never stop. I've looked everywhere in my code that I never run `isUserViewCurrentUser()` in a for loop or any loop.

This is my userData:

```
protocol SendUserDataDelegate {

    func userData() -> User
}

```

didSelect TableViewCell:

```
if let user = filteredUsers?[indexPath.row] {
        userToPass = user
        profileController?.userDataDelegate = self
        self.navigationController?.pushViewController(profileController!, animated: true)

    }

```

And this code at my cellRowAtIndexPath:

```
if isUserViewCurrentUser() == true {
            cell.bioAndFollowStackView.addSubview(cell.followButtonOutlet)
        } else {
            if cell.followButtonOutlet != nil {
                cell.followButtonOutlet.removeFromSuperview()
            }
        }

```

sending user object when user tabs a tableview cell into another viewController. and I call it whenever I want to get a reference to the user object