Skip to content

Commit

Permalink
SearchViewController: 最末端の空白を取り除くように
Browse files Browse the repository at this point in the history
  • Loading branch information
YuigaWada committed Apr 14, 2020
1 parent 30848c8 commit eade244
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion MissCat/View/SearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,18 @@ class SearchViewController: UIViewController, PolioPagerSearchTabDelegate, UITex
// MARK: Privates

private func search(with query: String) {
var query = query

if query.count > 0 {
let space = [" ", " "]
if space.filter({ query.suffix(1) == $0 }).count > 0 { // 最末端の空白を取り除く
query = String(query.prefix(query.count - 1))
}
}

if query.isEmpty {
animateTrend(trendIsHidden: false)
}

switch selected {
case .note:
guard query != noteQuery else { return }
Expand Down

0 comments on commit eade244

Please sign in to comment.