Skip to content

Commit 9ef5d9e

Browse files
committed
refactor: folder structure
1 parent 4194a97 commit 9ef5d9e

File tree

6 files changed

+63
-30
lines changed

6 files changed

+63
-30
lines changed

ios/CustomPhotoPicker/CustomPhotoPickerViewController.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,9 @@ extension CustomPhotoPickerViewController: PreviewHeaderViewDelegate {
114114

115115
func headerView(_: PreviewHeaderView, didPressDoneButton _: UIButton) {
116116
DispatchQueue.main.async {
117-
self.viewerController?.dismiss {
117+
self.viewerController?.dismiss(animated: false, completion: {
118118
self.dismiss(animated: true)
119-
}
119+
})
120120
}
121-
// let rect = CGRect(x: 0, y: 0, width: 50, height: 50)
122-
// self.optionsController = OptionsController(sourceView: button, sourceRect: rect)
123-
// self.optionsController!.delegate = self
124-
// self.viewerController?.present(self.optionsController!, animated: true, completion: nil)
125121
}
126122
}

ios/Extension/UIColor.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// UIColor.swift
3+
// CocoaAsyncSocket
4+
//
5+
// Created by BẢO HÀ on 12/09/2023.
6+
//
7+
8+
import UIKit
9+
10+
extension UIColor {
11+
convenience init(hex: String) {
12+
var cString: String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
13+
14+
if cString.hasPrefix("#") {
15+
cString.remove(at: cString.startIndex)
16+
}
17+
18+
if (cString.count) != 6 {
19+
self.init(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0) // Màu mặc định nếu chuỗi không hợp lệ
20+
} else {
21+
var rgbValue: UInt64 = 0
22+
Scanner(string: cString).scanHexInt64(&rgbValue)
23+
24+
self.init(
25+
red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
26+
green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
27+
blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
28+
alpha: CGFloat(1.0)
29+
)
30+
}
31+
}
32+
}

ios/Extension/UIImage.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// UIColor.swift
3+
// CocoaAsyncSocket
4+
//
5+
// Created by BẢO HÀ on 12/09/2023.
6+
//
7+
8+
import UIKit
9+
10+
extension UIImage {
11+
func getTintColor(_ color: UIColor) -> UIImage? {
12+
if #available(iOS 13.0, *) {
13+
return self.withTintColor(color, renderingMode: .alwaysOriginal)
14+
} else {
15+
UIGraphicsBeginImageContextWithOptions(size, false, scale)
16+
// 1
17+
let drawRect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
18+
// 2
19+
color.setFill()
20+
UIRectFill(drawRect)
21+
// 3
22+
draw(in: drawRect, blendMode: .destinationIn, alpha: 1)
23+
24+
let tintedImage = UIGraphicsGetImageFromCurrentImageContext()
25+
UIGraphicsEndImageContext()
26+
return tintedImage!
27+
}
28+
}
29+
}

ios/MultipleImagePicker.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -336,27 +336,3 @@ extension UIViewController {
336336
return topMostViewController
337337
}
338338
}
339-
340-
extension UIColor {
341-
convenience init(hex: String) {
342-
var cString: String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
343-
344-
if cString.hasPrefix("#") {
345-
cString.remove(at: cString.startIndex)
346-
}
347-
348-
if (cString.count) != 6 {
349-
self.init(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0) // Màu mặc định nếu chuỗi không hợp lệ
350-
} else {
351-
var rgbValue: UInt64 = 0
352-
Scanner(string: cString).scanHexInt64(&rgbValue)
353-
354-
self.init(
355-
red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
356-
green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
357-
blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
358-
alpha: CGFloat(1.0)
359-
)
360-
}
361-
}
362-
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)