From eade244f83d7c4c55cc205262250d2a19f719c46 Mon Sep 17 00:00:00 2001 From: YuigaWada Date: Tue, 14 Apr 2020 23:00:52 +0900 Subject: [PATCH] =?UTF-8?q?SearchViewController:=20=E6=9C=80=E6=9C=AB?= =?UTF-8?q?=E7=AB=AF=E3=81=AE=E7=A9=BA=E7=99=BD=E3=82=92=E5=8F=96=E3=82=8A?= =?UTF-8?q?=E9=99=A4=E3=81=8F=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MissCat/View/SearchViewController.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MissCat/View/SearchViewController.swift b/MissCat/View/SearchViewController.swift index 673cf42..81a77a2 100644 --- a/MissCat/View/SearchViewController.swift +++ b/MissCat/View/SearchViewController.swift @@ -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 }