Composable Architecture (сокращенно TCA) - это библиотека для создания приложений в последовательном и понятном виде, с учетом композиции, тестирования и эргономики. Ее можно использовать
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- СОЗДАЕМ ТАБЛИЦЫ | |
-- Таблица "Authors" (Авторы) | |
CREATE TABLE Authors ( | |
author_id SERIAL PRIMARY KEY, | |
first_name VARCHAR(100) NOT NULL, | |
last_name VARCHAR(100) NOT NULL, | |
birthdate DATE, | |
country VARCHAR(100) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getVideosFor(query: String) -> Set<String> { | |
let safeQuery = query.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | |
let myURLString = "https://www.youtube.com/results?search_query=\(safeQuery)" | |
guard let myURL = URL(string: myURLString) else { | |
print("Error: \(myURLString) doesn't seem to be a valid URL") | |
return Set() | |
} | |
do { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function textColorForBackground(hexColor: string): 'white' | 'black' { | |
let hex = hexColor.replace('#', ''); | |
let r = parseInt(hex.substr(0, 2), 16); | |
let g = parseInt(hex.substr(2, 2), 16); | |
let b = parseInt(hex.substr(4, 2), 16); | |
let brightness = (r * 299 + g * 587 + b * 114) / 1000; | |
return brightness > 155 ? 'black' : 'white'; | |
} |