Skip to content

Instantly share code, notes, and snippets.

View takasurazeem's full-sized avatar
🏠
Working from home

takasurazeem

🏠
Working from home
View GitHub Profile
//
// ContentView.swift
// StateSample
//
// Created by Martin Poulsen on 2024-12-01.
//
import SwiftUI
// View protocol is on the @MainActor (and Maintread).
//------------------------------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths)
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect)
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier)
//------------------------------------------------------------------------
import SwiftUI
struct ContentView: View {
import UIKit
class PopupNavigationController: UINavigationController {
override init(rootViewController: UIViewController) {
super.init(rootViewController: rootViewController)
commonInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
@takasurazeem
takasurazeem / UIView+Spinning.swift
Created June 23, 2022 08:34 — forked from jeffaburt/UIView+Spinning.swift
Allows any kind of UIView to start spinning in a 360 rotation
import UIKit
extension UIView {
func startSpinning() {
let spinAnimation = CABasicAnimation()
spinAnimation.fromValue = 0
spinAnimation.toValue = M_PI * 2
spinAnimation.duration = 2.5
spinAnimation.repeatCount = Float.infinity
spinAnimation.removedOnCompletion = false
import UIKit
/**
A UILabel subclass that will vertically distribute text evenly across any
number of lines, preventing text from grouping up at the top.
Example:
(1)
This text:
extension UIImageView {
/// Loads image from web asynchronosly and caches it, in case you have to load url
/// again, it will be loaded from cache if available
func load(url: URL, placeholder: UIImage?, cache: URLCache? = nil) {
let cache = cache ?? URLCache.shared
let request = URLRequest(url: url)
if let data = cache.cachedResponse(for: request)?.data, let image = UIImage(data: data) {
self.image = image
} else {
self.image = placeholder
@takasurazeem
takasurazeem / SCService.swift
Last active January 15, 2022 19:33
Alamofire Wrapper
//
// SCService.swift
//
// Created by Takasur Azeem on 09/03/2021.
//
import Alamofire
/// `SCRequest` is just a name, `SC` is the project name initials, I could use `TA` as well. You can name them anything.