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:
parent
553f5ba62b
commit
296a3cbcfa
3 changed files with 35 additions and 15 deletions
21
pass/Helpers/SearchBarScope.swift
Normal file
21
pass/Helpers/SearchBarScope.swift
Normal 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()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue