Skip to content

Instantly share code, notes, and snippets.

//
// UIDevice+DeviceModel.swift
// Extensions
//
// Created on Friday, July 14, 2023
// Created by Abdelrahman Abo Al Nasr
//
// Copyright © 2024 Abdelrahman Abo Al Nasr. All rights reserved.
//
@abdelrahmanTD
abdelrahmanTD / View+SizeToFitWidth.swift
Created September 13, 2024 01:44
SwiftUI view modifier that dynamically adjust the width of a view based on its content using GeometryReader. This modifier is useful for views that need to adapt to changes in their content’s width.
//
// View+SizeToFitWidth.swift
// View Modifier
//
// Created on Thursday, August 8, 2024
// Created by Abdelrahman Abo Al Nasr
//
// Copyright © 2024 Abdelrahman Abo Al Nasr. All rights reserved.
//
@abdelrahmanTD
abdelrahmanTD / View+SizeToFitHeight.swift
Created September 13, 2024 01:41
SwiftUI view modifier that dynamically adjust the height of a view based on its content using GeometryReader. This modifier is useful for views that need to adapt to changes in their content’s height.
//
// View+SizeToFitHeight.swift
// View Modifiers
//
// Created on Thursday, August 8, 2024
// Created by Abdelrahman Abo Al Nasr
//
// Copyright © 2024 Abdelrahman Abo Al Nasr. All rights reserved.
//
@abdelrahmanTD
abdelrahmanTD / View+RoundedBackgroundViewModifier.swift
Last active September 13, 2024 01:26
SwiftUI view modifier that applies a rounded background with a custom color and corner radius to any view using a view modifier.
//
// View+RoundedBackgroundViewModifier.swift
// View Modifier
//
// Created on Tuesday, August 27, 2024
// Created by Abdelrahman Abo Al Nasr
//
// Copyright © 2024 Abdelrahman Abo Al Nasr. All rights reserved.
//
@abdelrahmanTD
abdelrahmanTD / View+RoundedBorderViewModifier.swift
Last active September 13, 2024 01:28
SwiftUI view modifier that applies a rounded border with a custom color and corner radius to any view using a view modifier.
//
// View+RoundedBorderViewModifier.swift
// ViewModifiers
//
// Created on Thursday, August 29, 2024
// Created by Abdelrahman Abo Al Nasr
//
// Copyright © 2024 Abdelrahman Abo Al Nasr. All rights reserved.
//
@abdelrahmanTD
abdelrahmanTD / ColorExtension.swift
Last active January 3, 2022 21:35
Extension Color for converting hex codes
import SwiftUI
public extension Color {
init(hexCode: String) {
let scanner = Scanner(string: hexCode)
var rgbValue: UInt64 = 0
scanner.scanHexInt64(&rgbValue)
let r = (rgbValue & 0xff0000) >> 16
let g = (rgbValue & 0xff00) >> 8