Skip to content

Commit ceb8081

Browse files
author
VishwaiOSDev
committed
feat: migrated loadify kit
1 parent 883d30a commit ceb8081

7 files changed

Lines changed: 67 additions & 13 deletions

File tree

Loadify.xcodeproj/project.pbxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
884BDB142AB14DA200A4828B /* LoaderViewAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 884BDB122AB14DA200A4828B /* LoaderViewAction.swift */; };
4141
884BDB162AB14E0000A4828B /* View+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 884BDB152AB14E0000A4828B /* View+Extension.swift */; };
4242
884BDB182AB14E7600A4828B /* HUDComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 884BDB172AB14E7600A4828B /* HUDComponents.swift */; };
43+
884BDB1A2AB14EB400A4828B /* Task+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 884BDB192AB14EB400A4828B /* Task+Extension.swift */; };
4344
888BD49B2A784F3900A835C5 /* Detailable+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 888BD49A2A784F3900A835C5 /* Detailable+Extension.swift */; };
4445
889714F82932618200D8B1B7 /* DownloadStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 889714F72932618200D8B1B7 /* DownloadStatus.swift */; };
4546
88A729AE28264AD100B5FE61 /* LoadifyApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88A729AD28264AD100B5FE61 /* LoadifyApp.swift */; };
@@ -110,6 +111,7 @@
110111
884BDB122AB14DA200A4828B /* LoaderViewAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoaderViewAction.swift; sourceTree = "<group>"; };
111112
884BDB152AB14E0000A4828B /* View+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extension.swift"; sourceTree = "<group>"; };
112113
884BDB172AB14E7600A4828B /* HUDComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDComponents.swift; sourceTree = "<group>"; };
114+
884BDB192AB14EB400A4828B /* Task+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Task+Extension.swift"; sourceTree = "<group>"; };
113115
888BD49A2A784F3900A835C5 /* Detailable+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Detailable+Extension.swift"; sourceTree = "<group>"; };
114116
889714F72932618200D8B1B7 /* DownloadStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadStatus.swift; sourceTree = "<group>"; };
115117
88A729AA28264AD100B5FE61 /* Loadify.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Loadify.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -182,8 +184,9 @@
182184
883233862855F34000BF38B5 /* Double+Extension.swift */,
183185
88379937283A1A0F00DDBA79 /* String+Extension.swift */,
184186
88498D4B29A285BE007303B0 /* Logger+Extension.swift */,
185-
884BDAED2AB14B8200A4828B /* UIDevice+Extension.swift */,
186187
884BDB152AB14E0000A4828B /* View+Extension.swift */,
188+
884BDB192AB14EB400A4828B /* Task+Extension.swift */,
189+
884BDAED2AB14B8200A4828B /* UIDevice+Extension.swift */,
187190
);
188191
path = Extensions;
189192
sourceTree = "<group>";
@@ -581,6 +584,7 @@
581584
884BDB132AB14DA200A4828B /* AlertViewAction.swift in Sources */,
582585
883233872855F34000BF38B5 /* Double+Extension.swift in Sources */,
583586
884BDB022AB14CF500A4828B /* AlertView.swift in Sources */,
587+
884BDB1A2AB14EB400A4828B /* Task+Extension.swift in Sources */,
584588
884BDAEE2AB14B8200A4828B /* UIDevice+Extension.swift in Sources */,
585589
88CD83B82827D77B00F520C0 /* ApiService.swift in Sources */,
586590
88B1CFAA2826BCA5007B19B4 /* DownloaderViewModel.swift in Sources */,

Loadify/App/LoadifyApp.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct LoadifyApp: App {
3535
}
3636

3737
// MARK: - Internal Helpers
38+
3839
func notifyWithHaptics(for type: UINotificationFeedbackGenerator.FeedbackType) {
3940
Haptific.simulate(.notification(style: type))
4041
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// Task+Extension.swift
3+
// Loadify
4+
//
5+
// Created by Vishweshwaran on 2023-09-12.
6+
//
7+
8+
import Foundation
9+
10+
public extension Task where Success == Never, Failure == Never {
11+
12+
static func sleep(seconds: TimeInterval) async throws {
13+
let duration = UInt64(seconds * 1_000_000_000)
14+
try await Task.sleep(nanoseconds: duration)
15+
}
16+
}

Loadify/Others/Extensions/UIDevice+Extension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Vishweshwaran on 2023-09-12.
66
//
77

8-
import Foundation
8+
import UIKit
99

1010
extension UIDevice {
1111

Loadify/Others/Extensions/View+Extension.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,34 @@ import SwiftUI
99

1010
extension View {
1111

12+
func embedInNavigation() -> some View {
13+
NavigationView { self }
14+
}
15+
16+
func cardView(color: Color, cornerRadius: CGFloat = 10) -> some View {
17+
modifier(CardView(color: color, cornerRadius: cornerRadius))
18+
}
19+
20+
func hideKeyboard() {
21+
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
22+
}
23+
24+
/// Applies the given transform if the given condition evaluates to `true`.
25+
/// - Parameters:
26+
/// - condition: The condition to evaluate.
27+
/// - transform: The transform to apply to the source `View`.
28+
/// - Returns: Either the original `View` or the modified `View` if the condition is `true`.
29+
@ViewBuilder func `if`<Content: View>(
30+
_ condition: @autoclosure () -> Bool,
31+
transform: (Self) -> Content
32+
) -> some View {
33+
if condition() {
34+
transform(self)
35+
} else {
36+
self
37+
}
38+
}
39+
1240
/// This will return a loader from LoaderKit.
1341
/// This functions helps you to present `Loader` on top of the View Hierarchy
1442
/// - Parameters:

Loadify/Others/LoadifyConstants.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import SwiftUI
99

1010
typealias LoadifyTexts = Loadify.Texts
11-
typealias LoadifyColors = LoadifyKit.ColorKit
11+
public typealias LoadifyColors = LoadifyKit.ColorKit
1212
typealias LoadifyAssets = LoadifyKit.AssetKit
1313

1414
struct Loadify {
@@ -27,15 +27,15 @@ struct Loadify {
2727
}
2828
}
2929

30-
struct LoadifyKit {
30+
public struct LoadifyKit {
3131

32-
struct AssetKit {
33-
public static let loadifyHorizontal = Image("loadify_horizontal")
34-
public static let loadifyIcon = Image("loadify_icon")
35-
public static let notFound = Image("not_found")
32+
public struct AssetKit {
33+
static let loadifyHorizontal = Image("loadify_horizontal")
34+
static let loadifyIcon = Image("loadify_icon")
35+
static let notFound = Image("not_found")
3636
}
3737

38-
struct ColorKit {
38+
public struct ColorKit {
3939
public static let appBackground = Color("app_background")
4040
public static let greyText = Color("grey_text")
4141
public static let textfieldBackground = Color("textfield_background")
@@ -46,3 +46,8 @@ struct LoadifyKit {
4646
public static let successGreen = Color("success_green")
4747
}
4848
}
49+
50+
struct Constants {
51+
52+
static let iMacURL = "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/imac-refurb-about-201810?wid=984&hei=859&fmt=jpeg&qlt=90&.v=1541530952135"
53+
}

Loadify/View/Components/HUD/Model/HUDComponents.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ internal typealias Colors = HUDComponents.Colors
1212
internal struct HUDComponents {
1313

1414
struct Colors {
15-
static let green = Color("success_green", bundle: .module)
16-
static let gradient_green = Color("success_green_gradient", bundle: .module)
17-
static let red = Color("error_red", bundle: .module)
18-
static let red_gradient = Color("error_red_gradient", bundle: .module)
15+
static let green = Color("success_green")
16+
static let gradient_green = Color("success_green_gradient")
17+
static let red = Color("error_red")
18+
static let red_gradient = Color("error_red_gradient")
1919
}
2020
}

0 commit comments

Comments
 (0)