Mercurial > public > lazybear
diff LazyBear/Views/Profile/ProfileView.swift @ 452:bb69f9d1d20f
Implement HomeView in WatchOS
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sat, 26 Jun 2021 18:45:31 +0200 |
parents | 417148200aaf |
children |
line wrap: on
line diff
--- a/LazyBear/Views/Profile/ProfileView.swift Sat Jun 26 17:04:29 2021 +0200 +++ b/LazyBear/Views/Profile/ProfileView.swift Sat Jun 26 18:45:31 2021 +0200 @@ -96,24 +96,16 @@ Get symbols in watchlists (Core Data) -> Prepare url -> Request */ private func prepareUrl(_ requestType: RequestType) { - let symbols = watchlistCompanies.map { $0.symbol } - - var symbolString = "" - for (index, symbol) in symbols.enumerated() { - if index == 0 { - symbolString += symbol - } else { - symbolString += ",\(symbol)" - } - } + let symbols = Set(watchlistCompanies.map { $0.symbol }) + let symbolsString = symbols.joined(separator:",") switch requestType { case .initial: - let url = "https://api.lazybear.app/profile/type=initial/symbols=\(symbolString)" + let url = "https://api.lazybear.app/profile/type=initial/symbols=\(symbolsString)" profile.request(url, .initial) default: - let url = "https://api.lazybear.app/profile/type=streaming/symbols=\(symbolString)" + let url = "https://api.lazybear.app/profile/type=streaming/symbols=\(symbolsString)" profile.request(url, .streaming) } }