Skip to content

Instantly share code, notes, and snippets.

View ahmedAlmasri's full-sized avatar

Ahmad Almasri ahmedAlmasri

View GitHub Profile
func getPathPayer(arrPathPoints:[CGPoint]) throws -> CAShapeLayer {
enum PathError : Error{
case moreThan2PointsNeeded
}
guard arrPathPoints.count > 2 else {
throw PathError.moreThan2PointsNeeded
}
let lineColor = UIColor.blue
import Foundation
import UIKit
func getWidth() -> CGFloat{
return UIScreen.main.bounds.width
}
func getHeight() -> CGFloat{
return UIScreen.main.bounds.height
@ahmedAlmasri
ahmedAlmasri / ImageCompression.swift
Last active August 30, 2023 10:47
ios swift Image compression
//: Playground - noun: a place where people can play
import UIKit
do{
func compressImage(_ img:UIImage) -> UIImage? {
// Reducing file size to a 10th
var actualHeight: CGFloat = img.size.height
var actualWidth: CGFloat = img.size.width
let maxHeight: CGFloat = 1136.0