This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| public class BadgeBarButtonItem: UIBarButtonItem { | |
| @IBInspectable | |
| public var badgeNumber: Int = 0 { | |
| didSet { | |
| self.updateBadge() | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print(0..<200 ~= 159) // true | |
| print(0..<200 ~= 201) // false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let domain = Bundle.main.bundleIdentifier! | |
| UserDefaults.standard.removePersistentDomain(forName: domain) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UserDefaults.resetStandardUserDefaults() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var isLike = false | |
| if isLike { | |
| fetchDisLikeAPI() | |
| } else { | |
| fetchLikeAPI() | |
| } | |
| isLike.toggle() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var isLike = false | |
| if isLike { | |
| fetchDisLikeAPI() | |
| } else { | |
| fetchLikeAPI() | |
| } | |
| isLike = !isLike |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyCalss { | |
| var resultHandler: CompletionClosure = nil | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyCalss { | |
| var resultHandler: CompletionClosure | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typealias CompletionClosure = (() -> ())? |
NewerOlder