Skip to content

Instantly share code, notes, and snippets.

View daoseng33's full-sized avatar
🐰
woo la ya ha

DAO daoseng33

🐰
woo la ya ha
View GitHub Profile
@daoseng33
daoseng33 / UIImage+Clipp.swift
Last active July 19, 2023 07:02 — forked from StanDimitroff/UIImage+Clipp.swift
Image clipping to UIBezierPath
extension UIImage {
func imageByApplyingClippingBezierPath(_ path: UIBezierPath) -> UIImage? {
// Mask image using path
guard let let maskedImage = imageByApplyingMaskingBezierPath(path) else { return nil }
// Crop image to frame of path
let croppedImage = UIImage(cgImage: maskedImage.cgImage!.cropping(to: path.bounds)!)
return croppedImage
}
import UIKit
public class BadgeBarButtonItem: UIBarButtonItem {
@IBInspectable
public var badgeNumber: Int = 0 {
didSet {
self.updateBadge()
}
}
print(0..<200 ~= 159) // true
print(0..<200 ~= 201) // false
let domain = Bundle.main.bundleIdentifier!
UserDefaults.standard.removePersistentDomain(forName: domain)
UserDefaults.resetStandardUserDefaults()
var isLike = false
if isLike {
fetchDisLikeAPI()
} else {
fetchLikeAPI()
}
isLike.toggle()
var isLike = false
if isLike {
fetchDisLikeAPI()
} else {
fetchLikeAPI()
}
isLike = !isLike
class MyCalss {
var resultHandler: CompletionClosure = nil
}
class MyCalss {
var resultHandler: CompletionClosure
}
typealias CompletionClosure = (() -> ())?