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
import Foundation | |
import Reachability | |
//Reachability | |
//declare this property where it won't go out of scope relative to your listener | |
fileprivate var reachability: Reachability! | |
protocol ReachabilityActionDelegate { | |
func reachabilityChanged(_ isReachable: Bool) |
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
// | |
// FontManager.swift | |
// | |
// Created by http://www.popcornomnom.com | |
// Copyright © 2019 Marharyta Lytvynenko. All rights reserved. | |
// | |
import UIKit | |
import SwiftUI |
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
class ReachabilityHandler: ReachabilityObserverDelegate { | |
//MARK: Lifecycle | |
required init() { | |
try? addReachabilityObserver() | |
} | |
deinit { | |
removeReachabilityObserver() |
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
extension Font { | |
public static var title: Font { .init(.h3, .bold) } | |
} |
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
extension UIFont { | |
public static var title: UIFont { .init(.h3, .bold) } | |
} |
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
@available(iOS 13.0, *) | |
extension Font { | |
init(_ size: UIFont.Size, _ weight: UIFont.CustomWeight) { | |
self.init(.defaultFamily, size, weight) | |
} | |
init(_ family: UIFont.Family = .defaultFamily, | |
_ size: UIFont.Size, _ weight: UIFont.CustomWeight) { | |
self.init(UIFont(family, size, weight)) |
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
// | |
// FontManager.swift | |
// | |
// Created by http://www.popcornomnom.com | |
// Copyright © 2019 Marharyta Lytvynenko. All rights reserved. | |
// | |
import UIKit | |
//MARK: - Font Parts |
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
//put Family and Weight together | |
private class func stringName(_ family: Family, _ weight: CustomWeight) -> String { | |
let fontWeight: String | |
switch (family, weight) { | |
case (.inter, .heavy): | |
fontWeight = CustomWeight.semibold.rawValue | |
case (.inter, .light): | |
fontWeight = "\(weight.rawValue)BETA" | |
default: | |
fontWeight = weight.rawValue |
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
// | |
// FontManager.swift | |
// | |
// Created by http://www.popcornomnom.com | |
// Copyright © 2020 Marharyta Lytvynenko. All rights reserved. | |
// | |
import UIKit | |
///optional type in case if you don't want to support scaled font yet |
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
///optional type in case if you want turn off acessability support | |
private let acessabilitySettings: DynamicTypeSettings? = DynamicTypeSettings() | |
private class DynamicTypeSettings { | |
let maxPointSizeScaleFactor: CGFloat | |
init(maxPointSizeScaleFactor: CGFloat = 1.25) { | |
self.maxPointSizeScaleFactor = maxPointSizeScaleFactor |
NewerOlder