Skip to content

Instantly share code, notes, and snippets.

View 10Macit's full-sized avatar

Samet Macit 10Macit

  • Bulba
  • London
View GitHub Profile
@JamesSedlacek
JamesSedlacek / KeyboardToolbar.swift
Last active September 10, 2024 14:07
SwiftUI Keyboard Toolbar Workaround
//
// KeyboardToolbar.swift
//
// Created by James Sedlacek on 9/20/23.
//
import SwiftUI
import Combine
@Observable
class Button: UIButton {
var outset: CGSize = CGSize.zero
var shouldFitContentVertically: Bool = false {
didSet {
if shouldFitContentVertically {
titleLabel?.lineBreakMode = .byWordWrapping
titleLabel?.numberOfLines = 0
}
@chriseidhof
chriseidhof / collectionview.swift
Last active January 31, 2024 19:00
SwiftUI Flow Layout
//
// ContentView.swift
// DeleteMe
//
// Created by Chris Eidhof on 02.02.21.
//
import SwiftUI
/*
@srirammanian
srirammanian / PagingList.swift
Last active June 19, 2019 20:10
Generic infinite paging list in SwiftUI
//
// PagingList.swift
//
// Created by Sriram Manian on 6/17/19.
// Copyright © 2019 Sriram Manian. All rights reserved.
//
import SwiftUI
import Combine
@rnystrom
rnystrom / Cell.swift
Last active June 9, 2019 17:36
Self-sizing UITableViewCell with an h-scrolling UITextView
class Cell: UITableViewCell {
let textView = UITextView()
let scrollView = UIScrollView()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
scrollView.translatesAutoresizingMaskIntoConstraints = false
scrollView.alwaysBounceHorizontal = true
scrollView.scrollsToTop = false
@staminajim
staminajim / DispatchQueue+Dedupe.swift
Created January 8, 2019 11:47
Simple CGD Based Debouncing / Deduping
// Copyright (c) 2019, SeatGeek, Inc
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
@lpbas
lpbas / FadeView.swift
Last active July 24, 2024 05:07
Fade a UIView in iOS using Gradient (Swift Extension)
//
// This program is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What The Fuck You Want
// To Public License, Version 2, as published by Sam Hocevar. See
//
// http://sam.zoy.org/wtfpl/COPYING
//
// for more details.
//
import Foundation
import Photos
typealias AssetID = String
class ImageUtil {
static var defaultAlbumName = "App Name"
static var videosAlbumName = "App Name Videos"
@dars
dars / BackgroundTask.swift
Created September 8, 2017 13:01 — forked from phatmann/BackgroundTask.swift
Encapsulate iOS background tasks in a Swift class
class BackgroundTask {
private let application: UIApplication
private var identifier = UIBackgroundTaskInvalid
init(application: UIApplication) {
self.application = application
}
class func run(application: UIApplication, handler: (BackgroundTask) -> ()) {
// NOTE: The handler must call end() when it is done