Introduce enum for scope of search bar

This simplifies the handling of the indices in the search bar scope list, replaces strings as keys and allows a proper localization not breaking any logic.
This commit is contained in:
Danny Moesch 2019-03-05 22:31:03 +01:00 committed by Mingshen Sun
parent 553f5ba62b
commit 296a3cbcfa
3 changed files with 35 additions and 15 deletions

View file

@ -0,0 +1,21 @@
//
// SearchBarScope.swift
// pass
//
// Created by Danny Moesch on 05.03.19.
// Copyright © 2019 Bob Sun. All rights reserved.
//
enum SearchBarScope: Int, CaseIterable {
case current
case all
var localizedName: String {
switch self {
case .current:
return "Current".localize()
case .all:
return "All".localize()
}
}
}