Skip to content

Instantly share code, notes, and snippets.

View khorbushko's full-sized avatar
💭
🇺🇦

hbk3 khorbushko

💭
🇺🇦
View GitHub Profile
@khorbushko
khorbushko / Extension to view
Created November 28, 2020 10:19
Alert for SwiftUI
extension View {
func uniAlert<Content>(
isShowing: Binding<Bool>,
@ViewBuilder content: @escaping () -> Content,
actions: [UniAlertButton]
) -> some View where Content: View {
UniAlert(
isShowing: isShowing,
displayContent: content(),
struct NavigationBarAppearenceColor: ViewModifier {
init(backgroundColor: UIColor?, tintColor: UIColor) {
let appearence = UINavigationBarAppearance()
appearence.configureWithOpaqueBackground()
appearence.backgroundColor = backgroundColor
appearence.titleTextAttributes = [.foregroundColor: tintColor]
appearence.largeTitleTextAttributes = [.foregroundColor: tintColor]
UINavigationBar.appearance().standardAppearance = appearence
@khorbushko
khorbushko / NavigationConfigurationViewModifier
Last active November 24, 2020 10:18
NavigationBar - change backgroundColor
extension View {
func configureNavigationBar(_ configure: @escaping (UINavigationBar) -> ()) -> some View {
modifier(NavigationConfigurationViewModifier(configure: configure))
}
}
struct NavigationConfigurationViewModifier: ViewModifier {
let configure: (UINavigationBar) -> ()
@khorbushko
khorbushko / FatSlider
Last active November 23, 2020 14:04
FatSlider for swiftUI
import Foundation
import SwiftUI
struct FatSlider: View {
/// value in range 0...1
@Binding var percentage: Float
var backgroundTint: Color = Design.Colors.lightGray
var pickerTint: Color = Design.Colors.orangeyRed
var pickerShadowColor: Color = Design.Colors.black50
@khorbushko
khorbushko / InfoPlist
Created March 3, 2020 09:31
Plist reader
import UIKit
// MARK: - URLScheme
public typealias URLScheme = String
// MARK: - URLType
public struct URLType: Codable {
@khorbushko
khorbushko / HTTPHeader
Created March 3, 2020 09:28
HTTPHeaders list
import Foundation
/// Permanent Message Header Field Names
///
/// Expert Review
///
/// Expert(s)
/// Graham Klyne
///
/// Reference
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
System Sound iOS
SoundID File name Category
1000 new-mail.caf MailReceived
1001 mail-sent.caf MailSent
1002 Voicemail.caf VoicemailReceived
1003 ReceivedMessage.caf SMSReceived
1004 SentMessage.caf SMSSent
1005 alarm.caf CalendarAlert
1006 low_power.caf LowPower
import UIKit
extension UIBezierPath {
// swiftlint:disable:next function_body_length
static func roundedRectPath(basedOn rect: CGRect, cornerRadius: CGFloat, corners: UIRectCorner) -> UIBezierPath {
let origin = rect.origin
let size = rect.size
let point1 = CGPoint(x: origin.x + cornerRadius, y: origin.y)
@khorbushko
khorbushko / AppLogger
Created November 15, 2019 13:49
print listener
import Foundation
import CocoaLumberjack
typealias FilePath = String
final class AppLogger {
private static let listener = ConsoleEavesdropper()
// MARK: - Logger