IME // +RangeReplaceableCollection <- ctlPrefWindow.
This commit is contained in:
parent
2194f503a8
commit
3bd8da529f
|
@ -225,3 +225,14 @@ import Cocoa
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Root Extensions
|
||||
|
||||
// Extend the RangeReplaceableCollection to allow it clean duplicated characters.
|
||||
// Ref: https://stackoverflow.com/questions/25738817/
|
||||
extension RangeReplaceableCollection where Element: Hashable {
|
||||
var charDeDuplicate: Self {
|
||||
var set = Set<Element>()
|
||||
return filter { set.insert($0).inserted }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,14 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
import Carbon
|
||||
import Cocoa
|
||||
|
||||
// Extend the RangeReplaceableCollection to allow it clean duplicated characters.
|
||||
extension RangeReplaceableCollection where Element: Hashable {
|
||||
var charDeDuplicate: Self {
|
||||
var set = Set<Element>()
|
||||
return filter { set.insert($0).inserted }
|
||||
}
|
||||
}
|
||||
|
||||
// Please note that the class should be exposed using the same class name
|
||||
// in Objective-C in order to let IMK to see the same class name as
|
||||
// the "InputMethodServerPreferencesWindowControllerClass" in Info.plist.
|
||||
|
|
Loading…
Reference in New Issue