Running a refactor in Xcode can sometimes show Rename failed message. This can be fixed by quitting Xcode, cleaning derived data folder and doing a rebuild followed by the refactoring. Below is a script to clean the derived data folder.

Renamed failed in Xcode

#!/bin/bash
# Clean Xcode cache

rm -frd ~/Library/Developer/Xcode/DerivedData/* 
rm -frd ~/Library/Caches/com.apple.dt.Xcode/*

After cleaning the caches, launch Xcode and build the project. Then wait for any indexing tasks to complete. Then try Refactor > Rename and this should work.