-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00bb194
commit 582491d
Showing
32 changed files
with
636 additions
and
111 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// UIEdgeInsets+Extensions.swift | ||
// OYExtensions | ||
// | ||
// Created by osmanyildirim | ||
// | ||
|
||
import UIKit | ||
|
||
extension UIEdgeInsets { | ||
/// `UIEdgeInsets.oy_init(0, 10, 20, 30)` → output → UIEdgeInsets(top: 0.0, left: 10.0, bottom: 20.0, right: 30.0) | ||
public static func oy_init(_ top: CGFloat, _ left: CGFloat, _ bottom: CGFloat, _ right: CGFloat) -> UIEdgeInsets { | ||
UIEdgeInsets(top: top, left: left, bottom: bottom, right: right) | ||
} | ||
|
||
/// let value = UIEdgeInsets(top: 0, left: 10, bottom: 20, right: 30) | ||
/// `value.oy_top` → output → 0.0 | ||
public var oy_top: CGFloat { | ||
get { top } | ||
set(value) { top = value } | ||
} | ||
|
||
/// let value = UIEdgeInsets(top: 0, left: 10, bottom: 20, right: 30) | ||
/// `value.oy_bottom` → output → 20.0 | ||
public var oy_bottom: CGFloat { | ||
get { bottom } | ||
set(value) { bottom = value } | ||
} | ||
|
||
/// let value = UIEdgeInsets(top: 0, left: 10, bottom: 20, right: 30) | ||
/// `value.oy_left` → output → 10.0 | ||
public var oy_left: CGFloat { | ||
get { self.left } | ||
set(value) { self.left = value } | ||
} | ||
|
||
/// let value = UIEdgeInsets(top: 0, left: 10, bottom: 20, right: 30) | ||
/// `value.oy_right` → output → 30.0 | ||
public var oy_right: CGFloat { | ||
get { self.right } | ||
set(value) { self.right = value } | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// UIRectCorner+Extensions.swift | ||
// OYExtensions | ||
// | ||
// Created by osmanyildirim | ||
// | ||
|
||
import Foundation | ||
|
||
extension UIRectCorner { | ||
public var caCornerMask: CACornerMask { | ||
switch self { | ||
case .topLeft: | ||
return .layerMinXMinYCorner | ||
case .bottomLeft: | ||
return .layerMinXMaxYCorner | ||
case .topRight: | ||
return .layerMaxXMinYCorner | ||
case .bottomRight: | ||
return .layerMaxXMaxYCorner | ||
default: | ||
return [] | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// OYSaveImage.swift | ||
// OYExtensions | ||
// | ||
// Created by osmanyildirim | ||
// | ||
|
||
import Foundation | ||
|
||
struct OYSaveImage { | ||
final class delegate: NSObject { | ||
let completion: ((Error?) -> Void)? | ||
|
||
init(completion: ((Error?) -> Void)?) { | ||
self.completion = completion | ||
} | ||
|
||
@objc func savedImage(_ image: UIImage, error: Error?, context: UnsafeMutableRawPointer?) { | ||
self.completion?(error) | ||
} | ||
} | ||
|
||
#warning("yorum ekle") | ||
func saveImage(image: UIImage, completion: ((Error?) -> Void)?) { | ||
let delegate = delegate(completion: completion) | ||
UIImageWriteToSavedPhotosAlbum(image, delegate, #selector(delegate.savedImage(_: error: context:)), nil) | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// CaseIterable+Extensions.swift | ||
// OYExtensions | ||
// | ||
// Created by osmanyildirim | ||
// | ||
|
||
import Foundation | ||
|
||
extension CaseIterable { | ||
/// Get random element of CaseIterable enum | ||
/// `Foo.oy_random` | ||
public static var oy_random: Self? { | ||
var generator = SystemRandomNumberGenerator() | ||
return randomCaseIterableElement(using: &generator) | ||
} | ||
} | ||
|
||
extension CaseIterable { | ||
private static func randomCaseIterableElement(using generator: inout some RandomNumberGenerator) -> Self? { | ||
allCases.randomElement(using: &generator) | ||
} | ||
} |
Oops, something went wrong.