Skip to content

Instantly share code, notes, and snippets.

View Ali72's full-sized avatar
🤓
Working from home

Ali khajehpour Ali72

🤓
Working from home
View GitHub Profile
@sebj
sebj / Guide.md
Last active April 8, 2025 18:04
Add a scene delegate back to a SwiftUI Project

Define an application delegate

See also: UIApplicationDelegate documentation

// AppDelegate.swift
@main
final class AppDelegate: NSObject, UIApplicationDelegate {

    func application(
        _ application: UIApplication,
@barisuyar
barisuyar / Slider.swift
Created December 1, 2021 19:56
Complete Slider
import UIKit
final class Slider: UISlider {
private let baseLayer = CALayer() // Step 3
private let trackLayer = CAGradientLayer() // Step 7
override func draw(_ rect: CGRect) {
super.draw(rect)
setup()
@jyshnkr
jyshnkr / Rename Xcode Project.md
Last active April 30, 2025 16:28
How to Rename the Xcode Project (Including all the files & folders)

Rename the Xcode Project (Including Files and Folders)

Step 1 - Rename the project:

  1. Click on the project you want to rename in the "Project navigator" in the left panel of the Xcode window.

  2. In the right panel, select the "File inspector", and the name of your project should be found under "Identity and Type". Change it to your new name.

  3. When the dialog asks whether to rename or not rename the project's content items, click "Rename". Say yes to any warning about uncommitted changes.

@irazasyed
irazasyed / mysq-mariadb-macos-start-issue.md
Created October 7, 2020 00:05
Solution for MySQL / MariaDB Start Issue on MacOS

Solution for MySQL / MariaDB Start Issue on MacOS

Errors

On trying to start mysql.server start

./usr/local/bin/mysql.server: line 264: kill: (12262) - No such process ERROR!

@kazimunshimun
kazimunshimun / ContentView.swift
Created September 10, 2020 19:25
SwiftUI Circular Slider
//
// ContentView.swift
// TemperatureControl
//
// Created by Anik on 10/9/20.
//
import SwiftUI
struct ContentView: View {
@kshivang
kshivang / AVPlayer+Combine.swift
Last active April 11, 2025 15:13
Combine wrapper over AVPlayer.addPeriodicTimeObserver method. Use AVPlayer.periodicTimePublisher method instead.
import AVFoundation
import Combine
// simply use
// player.periodicTimePublisher()
// .receive(on: RunLoop.main)
// .assign(to: \SomeClass.elapsedTime, on: someInstance)
// .store(in: &cancelBag)
@IuriiIaremenko
IuriiIaremenko / Inject.swift
Last active September 4, 2022 10:56
Swift Dependency Injection via Property Wrapper
//
// Inject.swift
//
// Created by Iurii Iaremenko on 11.01.2020.
//
import Foundation
@propertyWrapper
public class Inject<Value> {
@grahampugh
grahampugh / Adobe CC Cleaner-postinstall.sh
Created November 18, 2019 15:06
A script to clean up properly the things that Adobe CC Cleaner fails to remove.
#!/bin/bash
## postinstall script to remove CCDA applications
# remove any existing version of the tool
echo "Moving the CC Cleaner app to Utilities in case users need it later"
rm -rf /Applications/Utilities/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app ||:
mv /Applications/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app /Applications/Utilities/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app
# run the cleaner tool to remove EVERYTHING!
echo "Running the CC Cleaner app with 'removeAll=All' option"
@jmarkstar
jmarkstar / AlamofireCodable.swift
Last active June 6, 2023 16:45
Decode Alamofire response to a Generic codable type but if we get http code 400, I decode different json which is a error message.
@discardableResult
private func performRequest<T:Decodable>(route: APIRouter, decoder: JSONDecoder = JSONDecoder(), completion:@escaping (Int, Result<T>)->Void) -> DataRequest {
return Alamofire.request(route).responseData() { responseData in
guard let response = responseData.response else {
completion(APIClient.responseErrorCode, .failure(ApiError.internalServerError(NSLocalizedString("service_error", comment: AppConstant.EMPTY))))
return
}
@koingdev
koingdev / UIAlertControllerX.swift
Last active October 27, 2022 06:46
Easy way to show UIAlertController with Builder Pattern
extension UIAlertController {
// MARK: - Typealias
typealias Alert = UIAlertController
typealias Action = UIAlertAction
typealias Block = ((Alert) -> Void)?
// MARK: - Static function