             }
         }
     }
-    
+
     // MARK: - View cycle
 
     override func viewDidLoad() {

    
    @IBAction func previousButtonTapped(_ sender: UIButton) {
        print("previous")
    }
    
    @IBAction func nextButtonTapped(_ sender: UIButton) {
        print("next")
        self.selectNextPlaceholder()
    }
    
    // MARK: - Private functions

        }

        self.ranges = text.allRanges(of: self.placeholder)
    }

    private func smallerThan(operandA: Int, operandB: Int) -> Bool {
        return operandA < operandB
    }

    private func greaterThan(operandA: Int, operandB: Int) -> Bool {
        return operandA > operandB
    }

    private func selectPlaceholder(in ranges: [Range<String.Index>], with closure: (Int, Int) -> Bool) {
        guard let text = self.textView.text else {
            return
        }

        self.textView.becomeFirstResponder()

        self.updatePlaceholderRanges()

        // Find current cursor position
        guard let currentlySelectedRange = self.textView.selectedTextRange else {
            print("Couldn't find current range")
            return
        }

        var cursorPosition = self.textView.offset(from: self.textView.beginningOfDocument, to: currentlySelectedRange.start)

        for range in ranges {
            let rangeStart = text.distance(from: text.startIndex, to: range.lowerBound)
            let rangeEnd = text.distance(from: text.startIndex, to: range.upperBound)

            if closure(rangeStart, cursorPosition) {
                // Convert to UITextPosition, and set new selection
                let textPositionStart = self.textView.position(from: self.textView.beginningOfDocument, offset: rangeStart)
                let textPositionEnd = self.textView.position(from: self.textView.beginningOfDocument, offset: rangeEnd)
