Skip to content

Instantly share code, notes, and snippets.

View jabou's full-sized avatar

Jasmin Abou Aldan jabou

View GitHub Profile
@jabou
jabou / certificate_validity.sh
Created September 17, 2023 15:03
Certificate validty check script
# skip if we don't run in debug
if [ "$CONFIGURATION" != "Debug" ]; then
echo "Skip certificate check"
exit 0
fi
# 1 Create file for storing last shown date
if [ ! -d ~/.cache/ ]; then
mkdir ~/.cache/
@jabou
jabou / deploy.sh
Last active March 17, 2020 14:33
Deploy script used for creating the tag with tag message (change log) in format v1.2.3-1234, where v1.2.3 represents app version and 1234 represents build number (in this script, number is value of commit count)
#!/usr/bin/env bash
###############################################################
# DEPLOY SCRIPT #
# #
# Script used for creating the specific #
# tag used for triggering the CI deployment #
# #
# End tag should look like this: #
# internal-all/v1.0.0-1234 #
ThemeManager.apply(.red)
// application.keyWindow?.reload()
// Implementation
public extension UIWindow {
/// Unload all views and add them back
/// Used for applying `UIAppearance` changes to existing views
func reload() {
subviews.forEach { view in
view.removeFromSuperview()
class BlueTheme: ThemeProtocol {
var assets: Themeable {
return ThemeAssets(
labelAssets: AppLabelAssets(
color: UIColor.blue.primary,
font: .systemFont(ofSize: 18)
),
buttonAssets: AppButtonAssets(
normalBackgroundColor: UIColor.blue.primary,
func updateLabel(using themeAssets: LabelAssets) {
AppLabel.appearance().textColor = themeAssets.textColor
}
struct ThemeManager {
static func apply(_ theme: Theme, application: UIApplication) {
// 1
let appTheme = theme.appTheme
// 2
updateLabel(using: appTheme.assets.labelAssets)
// 3
appTheme.extension?()
// 4
struct LabelAssets {
var textColor: UIColor { get }
}
protocol Themeable {
var labelAssets: LabelAssets { get }
var buttonAssets: ButtonAssets { get }
var switchAssets: SwitchAssets { get }
// ...
}
protocol ThemeProtocol {
var assets: Themeable { get }
var `extension`: (() -> Void)? { get }
}