Skip to content

Instantly share code, notes, and snippets.

View EngOmarElsayed's full-sized avatar
🎯
Focusing

Omar Elsayed EngOmarElsayed

🎯
Focusing
View GitHub Profile
@EngOmarElsayed
EngOmarElsayed / HoriznatlPagingScrollView.swift
Last active April 4, 2025 02:21
A custom Container I created to easily create Paging scroll view in swiftUI, article: https://thinkdiffrent.substack.com/p/creating-paging-scrollview-using
#Preview {
@Previewable @State var currentPage = 0
HPagingScrollView(currentPage: $currentPage, spacing: 30, pageWidth: 200, pageHeight: 450) {
RoundedRectangle(cornerRadius: 20)
RoundedRectangle(cornerRadius: 20)
RoundedRectangle(cornerRadius: 20)
RoundedRectangle(cornerRadius: 20)
}
@JamesSedlacek
JamesSedlacek / View+OpenUrl.swift
Last active February 14, 2025 11:13
This file provides a safe way to open URLs in SwiftUI applications.
//
// View+OpenUrl.swift
//
// Created by James Sedlacek on 11/26/24.
//
/// This file provides a safe way to open URLs in SwiftUI applications.
/// It adds a view modifier that handles URL opening with user confirmation
/// and multiple opening options (browser, in-app, or copy to clipboard).
///
@jtvargas
jtvargas / MatrixEffect.swift
Created September 9, 2024 01:24
Stress Fiddle App in SwiftUI
//
// MatrixEffect.swift
//
// Created by J.T on 9/8/24.
//
import SwiftUI
import Combine
class MatrixEffectModel: ObservableObject {
@fatbobman
fatbobman / keyboardAvoiding.swift
Created May 13, 2024 03:49
keyboardAvoiding for List
// by klaytonb
// https://forums.developer.apple.com/forums/thread/699111?answerId=740437022#740437022
import Combine
import SwiftUI
public extension Publishers {
static var keyboardHeight: AnyPublisher<CGFloat, Never> {
let willShow = NotificationCenter.default.publisher(for: UIApplication.keyboardWillShowNotification)
.map { $0.keyboardHeight }
let willHide = NotificationCenter.default.publisher(for: UIApplication.keyboardWillHideNotification)
@aronbalog
aronbalog / ScrollViewWrapper.swift
Created March 17, 2020 10:57
UIScrollView Wrapper for SwiftUI
import SwiftUI
public struct ScrollViewWrapper<Content: View>: UIViewRepresentable {
@Binding var contentOffset: CGPoint
let content: () -> Content
public init(contentOffset: Binding<CGPoint>, @ViewBuilder _ content: @escaping () -> Content) {
self._contentOffset = contentOffset
self.content = content
}
@chriseidhof
chriseidhof / viewmirror.swift
Last active April 3, 2025 08:40
View Mirror
import SwiftUI
struct ContentView: View {
var body: some View {
HStack {
Text("Hello")
.padding()
.background(.blue)
.overlay {
Color.yellow