diff --git a/Bitkit/BitkitApp.swift b/Bitkit/BitkitApp.swift index f16d86037..a9e439c18 100644 --- a/Bitkit/BitkitApp.swift +++ b/Bitkit/BitkitApp.swift @@ -2,7 +2,7 @@ import SwiftUI // MARK: - Quick Action Notification -// Communication bridge between delegates and SwiftUI views +/// Communication bridge between delegates and SwiftUI views extension Notification.Name { static let quickActionSelected = Notification.Name("quickActionSelected") } @@ -28,7 +28,7 @@ class AppDelegate: NSObject, UIApplicationDelegate { // MARK: - Scene Configuration - // Required for SwiftUI apps to handle quick actions + /// Required for SwiftUI apps to handle quick actions func application( _ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, @@ -58,7 +58,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate { Logger.error("🔔 AppDelegate: didFailToRegisterForRemoteNotificationsWithError: \(error)") } - // Foreground notification presentation + /// Foreground notification presentation func userNotificationCenter( _ center: UNUserNotificationCenter, willPresent notification: UNNotification, @@ -73,7 +73,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate { completionHandler([[.banner, .badge, .sound]]) } - // Handle taps on notifications + /// Handle taps on notifications func userNotificationCenter( _ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, diff --git a/Bitkit/Components/Button/Button.swift b/Bitkit/Components/Button/Button.swift index e3b97d89d..daeb7d171 100644 --- a/Bitkit/Components/Button/Button.swift +++ b/Bitkit/Components/Button/Button.swift @@ -70,7 +70,7 @@ struct CustomButton: View { @State private var isPressed = false - // Base initializer for optional action + /// Base initializer for optional action init( title: String, variant: Variant = .primary, @@ -93,7 +93,7 @@ struct CustomButton: View { destination = nil } - // Trailing closure initializer + /// Trailing closure initializer init( title: String, variant: Variant = .primary, @@ -117,7 +117,7 @@ struct CustomButton: View { destination = nil } - // Navigation link initializer + /// Navigation link initializer init( title: String, variant: Variant = .primary, diff --git a/Bitkit/Components/CircularIcon.swift b/Bitkit/Components/CircularIcon.swift index adbe66fe8..160fb72be 100644 --- a/Bitkit/Components/CircularIcon.swift +++ b/Bitkit/Components/CircularIcon.swift @@ -5,7 +5,7 @@ struct CircularIcon: View { let backgroundColor: Color let size: CGFloat - // Initializer for string icons + /// Initializer for string icons init(icon: String, iconColor: Color = .white, backgroundColor: Color = .white10, size: CGFloat = 32) { content = AnyView( Image(icon) @@ -18,7 +18,7 @@ struct CircularIcon: View { self.size = size } - // Initializer for view icons (direct View parameter) + /// Initializer for view icons (direct View parameter) init(icon: some View, backgroundColor: Color = .white10, size: CGFloat = 32) { content = AnyView(icon) self.backgroundColor = backgroundColor diff --git a/Bitkit/Components/Core/ButtonLocationTracking.swift b/Bitkit/Components/Core/ButtonLocationTracking.swift index d899ab6bb..5e0591e1a 100644 --- a/Bitkit/Components/Core/ButtonLocationTracking.swift +++ b/Bitkit/Components/Core/ButtonLocationTracking.swift @@ -17,11 +17,6 @@ private struct ButtonLocationModifier: ViewModifier { /// Callback when the view's location changes let onLocationChanged: (CGRect) -> Void - init(coordinateSpace: String, onLocationChanged: @escaping (CGRect) -> Void) { - self.coordinateSpace = coordinateSpace - self.onLocationChanged = onLocationChanged - } - func body(content: Content) -> some View { content .background( diff --git a/Bitkit/Components/Core/DraggableList.swift b/Bitkit/Components/Core/DraggableList.swift index 20934bf18..e96307bcb 100644 --- a/Bitkit/Components/Core/DraggableList.swift +++ b/Bitkit/Components/Core/DraggableList.swift @@ -1,8 +1,8 @@ import SwiftUI /// Helper component that implements reorderable list functionality -struct DraggableList: View - where Data: RandomAccessCollection, ID: Hashable, Content: View, Data.Element: Identifiable +struct DraggableList: View + where Data.Element: Identifiable { /// The data to render in the list let data: Data @@ -174,7 +174,7 @@ struct DraggableList: View } } -// Default initializer for DraggableList that uses Element.id +/// Default initializer for DraggableList that uses Element.id extension DraggableList where ID == Data.Element.ID { /// Convenience initializer that uses the element's id property /// - Parameters: diff --git a/Bitkit/Components/DrawerView.swift b/Bitkit/Components/DrawerView.swift index 70168c5dc..80dc4ff65 100644 --- a/Bitkit/Components/DrawerView.swift +++ b/Bitkit/Components/DrawerView.swift @@ -10,7 +10,9 @@ enum DrawerMenuItem: Int, CaseIterable, Identifiable, Hashable { case settings case appStatus - var id: Int { rawValue } + var id: Int { + rawValue + } var icon: String { switch self { @@ -81,7 +83,6 @@ struct DrawerView: View { } } - @ViewBuilder private var backdrop: some View { Color.black.opacity(0.6) .ignoresSafeArea() @@ -170,7 +171,6 @@ struct DrawerView: View { } } - @ViewBuilder private func menuItemContent(item: DrawerMenuItem) -> some View { VStack(alignment: .leading, spacing: 0) { HStack(spacing: 12) { diff --git a/Bitkit/Components/Home/Suggestions.swift b/Bitkit/Components/Home/Suggestions.swift index fc467bf78..7ca04b0b2 100644 --- a/Bitkit/Components/Home/Suggestions.swift +++ b/Bitkit/Components/Home/Suggestions.swift @@ -140,13 +140,13 @@ struct Suggestions: View { @EnvironmentObject var suggestionsManager: SuggestionsManager @State private var showShareSheet = false - // Prevent duplicate item taps when the card is dismissed + /// Prevent duplicate item taps when the card is dismissed @State private var ignoringCardTaps = false let cardSize: CGFloat = 152 let cardSpacing: CGFloat = 16 - // Filter out cards that have already been completed or dismissed + /// Filter out cards that have already been completed or dismissed private var filteredCards: [SuggestionCardData] { cards.filter { card in // Filter out completed actions diff --git a/Bitkit/Components/LightningChannel.swift b/Bitkit/Components/LightningChannel.swift index 1433b8497..5d35ecfe3 100644 --- a/Bitkit/Components/LightningChannel.swift +++ b/Bitkit/Components/LightningChannel.swift @@ -151,14 +151,14 @@ struct LightningChannel: View { } } -// Extension to apply rounded corners to specific corners +/// Extension to apply rounded corners to specific corners extension View { func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View { clipShape(RoundedCornerShape(radius: radius, corners: corners)) } } -// Custom shape for specific rounded corners +/// Custom shape for specific rounded corners struct RoundedCornerShape: Shape { var radius: CGFloat = .infinity var corners: UIRectCorner = .allCorners diff --git a/Bitkit/Components/MoneyCell.swift b/Bitkit/Components/MoneyCell.swift index bcc10998e..14fd219d6 100644 --- a/Bitkit/Components/MoneyCell.swift +++ b/Bitkit/Components/MoneyCell.swift @@ -1,6 +1,6 @@ import SwiftUI -// MoneyCell - Cell/row style display for lists (right-aligned, compact layout) +/// MoneyCell - Cell/row style display for lists (right-aligned, compact layout) struct MoneyCell: View { let sats: Int let prefix: String diff --git a/Bitkit/Components/MoneyStack.swift b/Bitkit/Components/MoneyStack.swift index 8d7ffd564..1d90358a0 100644 --- a/Bitkit/Components/MoneyStack.swift +++ b/Bitkit/Components/MoneyStack.swift @@ -1,6 +1,6 @@ import SwiftUI -// MoneyStack - Stacked display with toggle functionality, optional eye icon and swipe gestures +/// MoneyStack - Stacked display with toggle functionality, optional eye icon and swipe gestures struct MoneyStack: View { let sats: Int var prefix: String? diff --git a/Bitkit/Components/MoneyText.swift b/Bitkit/Components/MoneyText.swift index ea2b1b34c..7350dd705 100644 --- a/Bitkit/Components/MoneyText.swift +++ b/Bitkit/Components/MoneyText.swift @@ -1,6 +1,6 @@ import SwiftUI -// MoneyText - Single text display component for monetary values +/// MoneyText - Single text display component for monetary values enum MoneySize { case display case title diff --git a/Bitkit/Components/NodeStateView.swift b/Bitkit/Components/NodeStateView.swift index dc41b1ce9..b8fe14c02 100644 --- a/Bitkit/Components/NodeStateView.swift +++ b/Bitkit/Components/NodeStateView.swift @@ -1,7 +1,7 @@ import LDKNode import SwiftUI -// So we can iterate through the balances +/// So we can iterate through the balances extension LightningBalance { var channelIdString: String { switch self { @@ -16,7 +16,7 @@ extension LightningBalance { } } -// Create a wrapper struct that conforms to Identifiable +/// Create a wrapper struct that conforms to Identifiable struct IdentifiableLightningBalance: Identifiable { let id: String let balance: LightningBalance diff --git a/Bitkit/Components/NumberPadTextField.swift b/Bitkit/Components/NumberPadTextField.swift index ec0c03b0e..057b562d6 100644 --- a/Bitkit/Components/NumberPadTextField.swift +++ b/Bitkit/Components/NumberPadTextField.swift @@ -1,6 +1,6 @@ import SwiftUI -// NumberPadTextField - Amount view to be used with number pad +/// NumberPadTextField - Amount view to be used with number pad struct NumberPadTextField: View { @EnvironmentObject var currency: CurrencyViewModel @ObservedObject var viewModel: AmountInputViewModel diff --git a/Bitkit/Components/RadioGroup.swift b/Bitkit/Components/RadioGroup.swift index 927642560..8449b92a5 100644 --- a/Bitkit/Components/RadioGroup.swift +++ b/Bitkit/Components/RadioGroup.swift @@ -30,11 +30,6 @@ struct RadioGroup: View { struct RadioOption { let title: String let value: T - - init(title: String, value: T) { - self.title = title - self.value = value - } } private struct RadioButton: View { diff --git a/Bitkit/Components/ShareSheet.swift b/Bitkit/Components/ShareSheet.swift index d2d69bc86..272e49a70 100644 --- a/Bitkit/Components/ShareSheet.swift +++ b/Bitkit/Components/ShareSheet.swift @@ -5,11 +5,10 @@ struct ShareSheet: UIViewControllerRepresentable { let activityItems: [Any] func makeUIViewController(context: Context) -> UIActivityViewController { - let controller = UIActivityViewController( + return UIActivityViewController( activityItems: activityItems, applicationActivities: nil ) - return controller } func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {} diff --git a/Bitkit/Components/SnapCarousel.swift b/Bitkit/Components/SnapCarousel.swift index d8ece3577..e142a4263 100644 --- a/Bitkit/Components/SnapCarousel.swift +++ b/Bitkit/Components/SnapCarousel.swift @@ -1,26 +1,12 @@ import SwiftUI -// UIKit Scroll View for better snapping behavior +/// UIKit Scroll View for better snapping behavior struct SnapCarousel: UIViewRepresentable { var items: [Item] var itemSize: CGFloat var itemSpacing: CGFloat var onItemTap: (Item) -> Void - var content: (Item) -> Content - - init( - items: [Item], - itemSize: CGFloat, - itemSpacing: CGFloat, - onItemTap: @escaping (Item) -> Void, - @ViewBuilder content: @escaping (Item) -> Content - ) { - self.items = items - self.itemSize = itemSize - self.itemSpacing = itemSpacing - self.onItemTap = onItemTap - self.content = content - } + @ViewBuilder var content: (Item) -> Content func makeCoordinator() -> Coordinator { Coordinator(self) @@ -102,7 +88,7 @@ struct SnapCarousel: UIViewRepresentable { } } - // Snap to the nearest item when scrolling ends + /// Snap to the nearest item when scrolling ends func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) { let itemWidthWithSpacing = parent.itemSize + parent.itemSpacing diff --git a/Bitkit/Components/Tags/Tag.swift b/Bitkit/Components/Tags/Tag.swift index 8970d0858..8e0c4fc64 100644 --- a/Bitkit/Components/Tags/Tag.swift +++ b/Bitkit/Components/Tags/Tag.swift @@ -23,7 +23,6 @@ struct Tag: View { self.onDelete = onDelete } - @ViewBuilder private var tagContent: some View { HStack(spacing: 0) { BodySSBText(value).lineLimit(1) diff --git a/Bitkit/Components/Widgets/BaseWidget.swift b/Bitkit/Components/Widgets/BaseWidget.swift index 9445ca86d..53d1b1d28 100644 --- a/Bitkit/Components/Widgets/BaseWidget.swift +++ b/Bitkit/Components/Widgets/BaseWidget.swift @@ -233,7 +233,7 @@ struct WidgetButtonStyle: ButtonStyle { } } -/// Preview for the BaseWidget +// Preview for the BaseWidget #Preview { VStack { BaseWidget( diff --git a/Bitkit/Components/Widgets/WidgetListItem.swift b/Bitkit/Components/Widgets/WidgetListItem.swift index 17b78ce9d..2e7eac316 100644 --- a/Bitkit/Components/Widgets/WidgetListItem.swift +++ b/Bitkit/Components/Widgets/WidgetListItem.swift @@ -6,7 +6,7 @@ struct WidgetListItem: View { @EnvironmentObject private var navigation: NavigationViewModel @EnvironmentObject private var currency: CurrencyViewModel - // Widget data computed from the ID + /// Widget data computed from the ID private var widget: (name: String, description: String, icon: String) { let name = t("widgets__\(id.rawValue)__name") diff --git a/Bitkit/Constants/Env.swift b/Bitkit/Constants/Env.swift index 46487f1ca..61354937d 100644 --- a/Bitkit/Constants/Env.swift +++ b/Bitkit/Constants/Env.swift @@ -61,7 +61,7 @@ enum Env { return isNotificationExtension ? .pushNotificationExtension : .foregroundApp } - // {Team ID}.{Keychain Group} + /// {Team ID}.{Keychain Group} /// Returns the keychain access group based on the current network static var keychainGroup: String { let base = "KYH47R284B.to.bitkit" diff --git a/Bitkit/Extensions/HexBytes.swift b/Bitkit/Extensions/HexBytes.swift index 2533f72cc..829fc19d5 100644 --- a/Bitkit/Extensions/HexBytes.swift +++ b/Bitkit/Extensions/HexBytes.swift @@ -7,8 +7,13 @@ extension Data { } extension StringProtocol { - var hexaData: Data { .init(hexa) } - var hexaBytes: [UInt8] { .init(hexa) } + var hexaData: Data { + .init(hexa) + } + + var hexaBytes: [UInt8] { + .init(hexa) + } private var hexa: UnfoldSequence { sequence(state: startIndex) { startIndex in diff --git a/Bitkit/Extensions/View+SafeArea.swift b/Bitkit/Extensions/View+SafeArea.swift index 371368478..c4a37d7bd 100644 --- a/Bitkit/Extensions/View+SafeArea.swift +++ b/Bitkit/Extensions/View+SafeArea.swift @@ -10,7 +10,7 @@ var hasHomeIndicator: Bool { return window.safeAreaInsets.bottom > 0 } -// For phones without a home indicator, we add padding to the bottom of the view +/// For phones without a home indicator, we add padding to the bottom of the view struct BottomSafeAreaPadding: ViewModifier { func body(content: Content) -> some View { content diff --git a/Bitkit/MainNavView.swift b/Bitkit/MainNavView.swift index e438be36f..8acce5c00 100644 --- a/Bitkit/MainNavView.swift +++ b/Bitkit/MainNavView.swift @@ -268,7 +268,6 @@ struct MainNavView: View { // MARK: - Computed Properties for Better Organization - @ViewBuilder private var navigationContent: some View { Group { switch navigation.activeDrawerMenuItem { diff --git a/Bitkit/Managers/BalanceManager.swift b/Bitkit/Managers/BalanceManager.swift index cdb535da9..06a7da988 100644 --- a/Bitkit/Managers/BalanceManager.swift +++ b/Bitkit/Managers/BalanceManager.swift @@ -239,12 +239,10 @@ class BalanceManager { /// Calculates maximum sendable Lightning amount (outbound capacity) private func calculateMaxSendLightning(channels: [ChannelDetails]) -> UInt64 { - let totalNextOutboundHtlcLimitSats = channels + return channels .filter(\.isUsable) .map(\.nextOutboundHtlcLimitMsat) .reduce(0, +) / 1000 // Convert from msat to sat - - return totalNextOutboundHtlcLimitSats } } diff --git a/Bitkit/Managers/NetworkMonitor.swift b/Bitkit/Managers/NetworkMonitor.swift index ea87d143c..49b6c716e 100644 --- a/Bitkit/Managers/NetworkMonitor.swift +++ b/Bitkit/Managers/NetworkMonitor.swift @@ -3,22 +3,22 @@ import SwiftUI @MainActor final class NetworkMonitor: ObservableObject { - // This will be used to track the network connectivity + /// This will be used to track the network connectivity @Published var isConnected = true - // This will be used to track if the network is expensive (e.g. cellular data) + /// This will be used to track if the network is expensive (e.g. cellular data) @Published var isExpensive = false @Published var networkType: NWInterface.InterfaceType? = .other - // This will be used to track the network path (e.g. Wi-Fi, cellular data, etc.) + /// This will be used to track the network path (e.g. Wi-Fi, cellular data, etc.) @Published var nwPath: NWPath? - // Create an instance of NWPathMonitor + /// Create an instance of NWPathMonitor let monitor = NWPathMonitor() init() { diff --git a/Bitkit/Managers/SessionManager.swift b/Bitkit/Managers/SessionManager.swift index ab19e0aa7..7653358a3 100644 --- a/Bitkit/Managers/SessionManager.swift +++ b/Bitkit/Managers/SessionManager.swift @@ -4,7 +4,7 @@ import SwiftUI @MainActor final class SessionManager: ObservableObject { @Published var id = UUID() - // When true, the next AppScene instance should skip showing the splash + /// When true, the next AppScene instance should skip showing the splash @Published var skipSplashOnce = false func bump() { diff --git a/Bitkit/Managers/TimedSheets/AppUpdateTimedSheet.swift b/Bitkit/Managers/TimedSheets/AppUpdateTimedSheet.swift index 777400a41..581e8c79d 100644 --- a/Bitkit/Managers/TimedSheets/AppUpdateTimedSheet.swift +++ b/Bitkit/Managers/TimedSheets/AppUpdateTimedSheet.swift @@ -10,7 +10,7 @@ struct AppUpdateTimedSheet: TimedSheetItem { private let appViewModel: AppViewModel private let appUpdateService = AppUpdateService.shared - // App update constants + /// App update constants private static let ASK_INTERVAL: TimeInterval = 12 * 60 * 60 // 12 hours - how long this prompt will not show after user dismisses init(appViewModel: AppViewModel) { diff --git a/Bitkit/Managers/TimedSheets/BackupTimedSheet.swift b/Bitkit/Managers/TimedSheets/BackupTimedSheet.swift index 56c534f85..ec7ea1d93 100644 --- a/Bitkit/Managers/TimedSheets/BackupTimedSheet.swift +++ b/Bitkit/Managers/TimedSheets/BackupTimedSheet.swift @@ -10,7 +10,7 @@ struct BackupTimedSheet: TimedSheetItem { private let walletViewModel: WalletViewModel private let appViewModel: AppViewModel - // Backup prompt constants + /// Backup prompt constants private static let ASK_INTERVAL: TimeInterval = 24 * 60 * 60 // 1 day - how long this prompt will not show after user dismisses init(appViewModel: AppViewModel, walletViewModel: WalletViewModel) { diff --git a/Bitkit/Managers/TimedSheets/NotificationsTimedSheet.swift b/Bitkit/Managers/TimedSheets/NotificationsTimedSheet.swift index 501b16394..8a463921e 100644 --- a/Bitkit/Managers/TimedSheets/NotificationsTimedSheet.swift +++ b/Bitkit/Managers/TimedSheets/NotificationsTimedSheet.swift @@ -30,9 +30,7 @@ struct NotificationsTimedSheet: TimedSheetItem { // Check if user has spending balance let hasSpendingBalance = walletViewModel.totalLightningSats > 0 - let shouldShow = !notificationsEnabled && !hasSeenNotificationsIntro && hasSpendingBalance - - return shouldShow + return !notificationsEnabled && !hasSeenNotificationsIntro && hasSpendingBalance } func onShown() { diff --git a/Bitkit/Managers/ToastWindowManager.swift b/Bitkit/Managers/ToastWindowManager.swift index 5e6200061..efa2aa0ea 100644 --- a/Bitkit/Managers/ToastWindowManager.swift +++ b/Bitkit/Managers/ToastWindowManager.swift @@ -189,7 +189,7 @@ class ToastWindowManager: ObservableObject { } } -// Custom window that only intercepts touches on interactive elements +/// Custom window that only intercepts touches on interactive elements class PassThroughWindow: UIWindow { var hasToast: Bool = false var toastFrame: CGRect = .zero diff --git a/Bitkit/Models/BackupPayloads.swift b/Bitkit/Models/BackupPayloads.swift index 45f4d8a40..9df74307e 100644 --- a/Bitkit/Models/BackupPayloads.swift +++ b/Bitkit/Models/BackupPayloads.swift @@ -56,12 +56,6 @@ struct SettingsBackupV1 { let createdAt: UInt64 let settings: [String: Any] - init(version: Int, createdAt: UInt64, settings: [String: Any]) { - self.version = version - self.createdAt = createdAt - self.settings = settings - } - static func decode(from data: Data) throws -> SettingsBackupV1 { guard let dict = try JSONSerialization.jsonObject(with: data) as? [String: Any], let version = dict["version"] as? Int, @@ -88,12 +82,6 @@ struct WidgetsBackupV1 { let createdAt: UInt64 let widgets: [String: Any] - init(version: Int, createdAt: UInt64, widgets: [String: Any]) { - self.version = version - self.createdAt = createdAt - self.widgets = widgets - } - static func decode(from data: Data) throws -> WidgetsBackupV1 { guard let dict = try JSONSerialization.jsonObject(with: data) as? [String: Any], let version = dict["version"] as? Int, diff --git a/Bitkit/Models/Currency.swift b/Bitkit/Models/Currency.swift index 464e2d249..f51f1f796 100644 --- a/Bitkit/Models/Currency.swift +++ b/Bitkit/Models/Currency.swift @@ -40,7 +40,9 @@ struct ConvertedAmount { let sats: UInt64 let btcValue: Decimal - var isSymbolSuffix: Bool { isSuffixSymbolCurrency(currency) } + var isSymbolSuffix: Bool { + isSuffixSymbolCurrency(currency) + } init(value: Decimal, formatted: String, symbol: String, currency: String, flag: String, sats: UInt64) { self.value = value diff --git a/Bitkit/Models/ElectrumServer.swift b/Bitkit/Models/ElectrumServer.swift index cc7be4293..1b43cdbb5 100644 --- a/Bitkit/Models/ElectrumServer.swift +++ b/Bitkit/Models/ElectrumServer.swift @@ -24,7 +24,7 @@ struct ElectrumServer: Equatable, Codable { return String(port) } - // Convenience initializer for string port + /// Convenience initializer for string port init(host: String, portString: String, protocolType: ElectrumProtocol) { self.host = host port = Int(portString) ?? 50001 diff --git a/Bitkit/SceneDelegate.swift b/Bitkit/SceneDelegate.swift index 9869fa080..51e36c932 100644 --- a/Bitkit/SceneDelegate.swift +++ b/Bitkit/SceneDelegate.swift @@ -3,7 +3,7 @@ import UIKit // MARK: - Scene Delegate for Quick Actions -// Handles scene lifecycle and quick actions for SwiftUI apps +/// Handles scene lifecycle and quick actions for SwiftUI apps class SceneDelegate: NSObject, UIWindowSceneDelegate { // MARK: - Quick Action State @@ -11,7 +11,7 @@ class SceneDelegate: NSObject, UIWindowSceneDelegate { // MARK: - Scene Connection - // Save quick action when scene is created + /// Save quick action when scene is created func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if let shortcutItem = connectionOptions.shortcutItem { savedShortCutItem = shortcutItem @@ -20,7 +20,7 @@ class SceneDelegate: NSObject, UIWindowSceneDelegate { // MARK: - Scene Activation - // Handle saved quick action when scene becomes active + /// Handle saved quick action when scene becomes active func sceneDidBecomeActive(_ scene: UIScene) { if let shortcutItem = savedShortCutItem { handleQuickAction(shortcutItem) @@ -30,7 +30,7 @@ class SceneDelegate: NSObject, UIWindowSceneDelegate { // MARK: - Quick Action Handling (App Running) - // Handle quick action when app is already running + /// Handle quick action when app is already running func windowScene( _ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, @@ -42,7 +42,7 @@ class SceneDelegate: NSObject, UIWindowSceneDelegate { // MARK: - Quick Action Processing - // Process quick action and notify SwiftUI views + /// Process quick action and notify SwiftUI views private func handleQuickAction(_ shortcutItem: UIApplicationShortcutItem) { let userInfo = ["shortcutType": shortcutItem.type] NotificationCenter.default.post(name: .quickActionSelected, object: nil, userInfo: userInfo) diff --git a/Bitkit/Services/CoreService.swift b/Bitkit/Services/CoreService.swift index a7651e37b..f65552329 100644 --- a/Bitkit/Services/CoreService.swift +++ b/Bitkit/Services/CoreService.swift @@ -26,7 +26,7 @@ class ActivityService { // MARK: - BoostTxIds Cache - // Cached set of transaction IDs that appear in boostTxIds (for filtering replaced transactions) + /// Cached set of transaction IDs that appear in boostTxIds (for filtering replaced transactions) private var cachedTxIdsInBoostTxIds: Set = [] /// Get the set of transaction IDs that appear in boostTxIds (cached for performance) diff --git a/Bitkit/Services/CurrencyService.swift b/Bitkit/Services/CurrencyService.swift index d32672afb..8975f79ac 100644 --- a/Bitkit/Services/CurrencyService.swift +++ b/Bitkit/Services/CurrencyService.swift @@ -65,9 +65,7 @@ class CurrencyService { raiseOnDivideByZero: false ) let roundedNumber = decimalNumber.rounding(accordingToBehavior: roundingBehavior) - let result = roundedNumber.uint64Value - - return result + return roundedNumber.uint64Value } } diff --git a/Bitkit/Services/LogService.swift b/Bitkit/Services/LogService.swift index f28018a20..685e7bfbd 100644 --- a/Bitkit/Services/LogService.swift +++ b/Bitkit/Services/LogService.swift @@ -32,9 +32,7 @@ class LogService { dateFormatter.timeZone = TimeZone(abbreviation: "UTC") let timestamp = dateFormatter.string(from: Date()) let fileName = "bitkit_logs_\(timestamp)" - let zipURL = try Zip.quickZipFiles(logFiles, fileName: fileName) - - return zipURL + return try Zip.quickZipFiles(logFiles, fileName: fileName) } catch { Logger.error(error, context: "Failed to create zip file for logs") diff --git a/Bitkit/Services/VssBackupClient.swift b/Bitkit/Services/VssBackupClient.swift index 54f9a10be..bb817c9f8 100644 --- a/Bitkit/Services/VssBackupClient.swift +++ b/Bitkit/Services/VssBackupClient.swift @@ -236,8 +236,7 @@ class VssBackupClient { try await awaitLdkSetup() Logger.debug("VSS 'getObjectLdk' call for '\(key)'", context: "VssBackupClient") do { - let item = try await vssLdkGet(key: key, namespace: namespace) - return item + return try await vssLdkGet(key: key, namespace: namespace) } catch { Logger.debug("VSS 'getObjectLdk' error for '\(key)': \(error)", context: "VssBackupClient") throw error diff --git a/Bitkit/Services/Widgets/NewsService.swift b/Bitkit/Services/Widgets/NewsService.swift index 3d3208c90..e02681ab3 100644 --- a/Bitkit/Services/Widgets/NewsService.swift +++ b/Bitkit/Services/Widgets/NewsService.swift @@ -31,8 +31,7 @@ class NewsService { do { let decoder = JSONDecoder() - let articles = try decoder.decode([Article].self, from: data) - return articles + return try decoder.decode([Article].self, from: data) } catch { throw error } diff --git a/Bitkit/Services/Widgets/PriceService.swift b/Bitkit/Services/Widgets/PriceService.swift index 650e92126..0569c0e77 100644 --- a/Bitkit/Services/Widgets/PriceService.swift +++ b/Bitkit/Services/Widgets/PriceService.swift @@ -74,7 +74,7 @@ public let tradingPairs: [TradingPair] = [ TradingPair(name: "BTC/JPY", base: "BTC", quote: "JPY", symbol: "¥"), ] -// Convenience array for just the pair names +/// Convenience array for just the pair names public let tradingPairNames: [String] = tradingPairs.map(\.name) // MARK: - Helper Models diff --git a/Bitkit/Utilities/Crypto.swift b/Bitkit/Utilities/Crypto.swift index d9b554687..952af5e46 100644 --- a/Bitkit/Utilities/Crypto.swift +++ b/Bitkit/Utilities/Crypto.swift @@ -84,9 +84,7 @@ class Crypto { do { let nonce = try AES.GCM.Nonce(data: payload.iv) let sealedBox = try AES.GCM.SealedBox(nonce: nonce, ciphertext: payload.cipher, tag: payload.tag) - let decryptedData = try AES.GCM.open(sealedBox, using: key) - - return decryptedData + return try AES.GCM.open(sealedBox, using: key) } catch { if let ce = error as? CryptoKit.CryptoKitError { Logger.warn(ce) diff --git a/Bitkit/Utilities/Haptics.swift b/Bitkit/Utilities/Haptics.swift index d7aeceecc..f0dfdbf87 100644 --- a/Bitkit/Utilities/Haptics.swift +++ b/Bitkit/Utilities/Haptics.swift @@ -151,11 +151,25 @@ class Haptics { // MARK: add aliases for common haptic feedback here extension UIImpactFeedbackGenerator.FeedbackStyle { - static var copiedToClipboard: UIImpactFeedbackGenerator.FeedbackStyle { .soft } - static var pastedFromClipboard: UIImpactFeedbackGenerator.FeedbackStyle { .medium } - static var scanSuccess: UIImpactFeedbackGenerator.FeedbackStyle { .heavy } - static var openSheet: UIImpactFeedbackGenerator.FeedbackStyle { .medium } - static var buttonTap: UIImpactFeedbackGenerator.FeedbackStyle { .light } + static var copiedToClipboard: UIImpactFeedbackGenerator.FeedbackStyle { + .soft + } + + static var pastedFromClipboard: UIImpactFeedbackGenerator.FeedbackStyle { + .medium + } + + static var scanSuccess: UIImpactFeedbackGenerator.FeedbackStyle { + .heavy + } + + static var openSheet: UIImpactFeedbackGenerator.FeedbackStyle { + .medium + } + + static var buttonTap: UIImpactFeedbackGenerator.FeedbackStyle { + .light + } } private enum HapticsError: Error { diff --git a/Bitkit/Utilities/LocalizeHelpers.swift b/Bitkit/Utilities/LocalizeHelpers.swift index 44a18662d..b5c4b325f 100644 --- a/Bitkit/Utilities/LocalizeHelpers.swift +++ b/Bitkit/Utilities/LocalizeHelpers.swift @@ -117,7 +117,7 @@ enum LocalizationHelper { // MARK: - Public API -// The main function for getting a localized string +/// The main function for getting a localized string func t(_ key: String, comment: String = "", variables: [String: String] = [:]) -> String { var localizedString = LocalizationHelper.getString(for: key, comment: comment) @@ -134,7 +134,7 @@ func tPlural(_ key: String, comment: String = "", arguments: [String: Any] = [:] return LocalizationHelper.formatPlural(localizedString, arguments: arguments) } -// Get a random line from a localized string +/// Get a random line from a localized string func localizedRandom(_ key: String, comment: String = "") -> String { let localizedString = LocalizationHelper.getString(for: key, comment: comment) let components = localizedString.components(separatedBy: "\n") diff --git a/Bitkit/Utilities/Logger.swift b/Bitkit/Utilities/Logger.swift index 858c17d0b..4f7f76d57 100644 --- a/Bitkit/Utilities/Logger.swift +++ b/Bitkit/Utilities/Logger.swift @@ -99,7 +99,7 @@ class Logger { } } - // Cleans up log files + /// Cleans up log files static func cleanUpOldLogFiles(maxTotalSizeMB: Int = 20) { queue.async { let baseDir = Env.logDirectory diff --git a/Bitkit/Utilities/StateLocker.swift b/Bitkit/Utilities/StateLocker.swift index 32fd4c037..60f71156d 100644 --- a/Bitkit/Utilities/StateLocker.swift +++ b/Bitkit/Utilities/StateLocker.swift @@ -45,7 +45,7 @@ public enum ExecutionContext: String, Codable { } } - // For log file names + /// For log file names var filenamePrefix: String { switch self { case .foregroundApp: diff --git a/Bitkit/Utilities/WidgetsBackupConverter.swift b/Bitkit/Utilities/WidgetsBackupConverter.swift index 7ca055d1c..823940f02 100644 --- a/Bitkit/Utilities/WidgetsBackupConverter.swift +++ b/Bitkit/Utilities/WidgetsBackupConverter.swift @@ -75,7 +75,7 @@ enum WidgetsBackupConverter { } } - let androidWidgetsData: [String: Any] = [ + return [ "widgets": widgetsArray, "headlinePreferences": newsPreferences ?? getDefaultNewsPreferences(), "factsPreferences": factsPreferences ?? getDefaultFactsPreferences(), @@ -92,8 +92,6 @@ enum WidgetsBackupConverter { "weather": NSNull(), "price": NSNull(), ] - - return androidWidgetsData } /// Converts Android `WidgetsData` format to iOS `[SavedWidget]` diff --git a/Bitkit/ViewModels/ActivityListViewModel.swift b/Bitkit/ViewModels/ActivityListViewModel.swift index 8a9c6c614..52f4c3214 100644 --- a/Bitkit/ViewModels/ActivityListViewModel.swift +++ b/Bitkit/ViewModels/ActivityListViewModel.swift @@ -30,10 +30,10 @@ class ActivityListViewModel: ObservableObject { @Published var selectedTags: Set = [] @Published var selectedTab: ActivityTab = .all - // Latest activities for home screen + /// Latest activities for home screen @Published var latestActivities: [Activity]? = nil - // Grouped activities for display + /// Grouped activities for display @Published var groupedActivities: [ActivityGroupItem] = [] private let coreService: CoreService diff --git a/Bitkit/ViewModels/NavigationViewModel.swift b/Bitkit/ViewModels/NavigationViewModel.swift index a848ae65f..fa8e7983b 100644 --- a/Bitkit/ViewModels/NavigationViewModel.swift +++ b/Bitkit/ViewModels/NavigationViewModel.swift @@ -73,7 +73,7 @@ enum Route: Hashable { case disablePin case changePin - // Backup settings + /// Backup settings case resetAndRestore // Advanced settings diff --git a/Bitkit/ViewModels/SettingsViewModel.swift b/Bitkit/ViewModels/SettingsViewModel.swift index 28d6addff..c2a4c3fb8 100644 --- a/Bitkit/ViewModels/SettingsViewModel.swift +++ b/Bitkit/ViewModels/SettingsViewModel.swift @@ -4,7 +4,7 @@ import LDKNode import SwiftUI import UserNotifications -// Avoids conflict with AddressViewer.AddressType +/// Avoids conflict with AddressViewer.AddressType typealias AddressScriptType = LDKNode.AddressType enum CoinSelectionMethod: String, CaseIterable { @@ -81,7 +81,7 @@ class SettingsViewModel: NSObject, ObservableObject { appStateSubject.eraseToAnyPublisher() } - // Security & Privacy Settings + /// Security & Privacy Settings @AppStorage("swipeBalanceToHide") private var _swipeBalanceToHide: Bool = true var swipeBalanceToHide: Bool { @@ -277,7 +277,7 @@ class SettingsViewModel: NSObject, ObservableObject { } } - // Address Type Settings + /// Address Type Settings /// Address types that support native SegWit scripts (required for Lightning). private static let nativeWitnessTypes: [AddressScriptType] = [.nativeSegwit, .taproot] diff --git a/Bitkit/ViewModels/TransferViewModel.swift b/Bitkit/ViewModels/TransferViewModel.swift index a9426149d..01f21194f 100644 --- a/Bitkit/ViewModels/TransferViewModel.swift +++ b/Bitkit/ViewModels/TransferViewModel.swift @@ -97,11 +97,9 @@ class TransferViewModel: ObservableObject { btNodeIds.contains(channel.counterpartyNodeId) } - let totalValue = btChannels.reduce(0) { sum, channel in + return btChannels.reduce(0) { sum, channel in sum + channel.channelValueSats } - - return totalValue } func onOrderCreated(order: IBtOrder) { diff --git a/Bitkit/ViewModels/Widgets/WeatherViewModel.swift b/Bitkit/ViewModels/Widgets/WeatherViewModel.swift index f25f70aa3..b005a9dd9 100644 --- a/Bitkit/ViewModels/Widgets/WeatherViewModel.swift +++ b/Bitkit/ViewModels/Widgets/WeatherViewModel.swift @@ -30,7 +30,7 @@ class WeatherViewModel: ObservableObject { private let vbytesSize = 140 // average native segwit transaction size - // Currency conversion dependency - will be set by views that need currency conversion + /// Currency conversion dependency - will be set by views that need currency conversion weak var currencyViewModel: CurrencyViewModel? /// Private initializer for the singleton instance diff --git a/Bitkit/ViewModels/WidgetsViewModel.swift b/Bitkit/ViewModels/WidgetsViewModel.swift index 3c80b1f07..e91fd37bd 100644 --- a/Bitkit/ViewModels/WidgetsViewModel.swift +++ b/Bitkit/ViewModels/WidgetsViewModel.swift @@ -9,7 +9,7 @@ protocol WidgetOptionsProtocol: Codable, Equatable { // MARK: - Widget Options Types -// Default options for each widget type +/// Default options for each widget type func getDefaultOptions(for type: WidgetType) -> Any { switch type { case .blocks: @@ -27,7 +27,7 @@ func getDefaultOptions(for type: WidgetType) -> Any { } } -// Empty options for widgets that don't have customization yet +/// Empty options for widgets that don't have customization yet struct EmptyWidgetOptions: Codable, Equatable {} // MARK: - Widget Metadata @@ -49,14 +49,12 @@ struct WidgetMetadata { struct Widget: Identifiable { let type: WidgetType - // Use type as identifier since only one widget per type is allowed - var id: WidgetType { type } - - init(type: WidgetType) { - self.type = type + /// Use type as identifier since only one widget per type is allowed + var id: WidgetType { + type } - // Widget metadata computed on demand + /// Widget metadata computed on demand func metadata(fiatSymbol: String = "$") -> WidgetMetadata { return WidgetMetadata(type: type, fiatSymbol: fiatSymbol) } @@ -101,26 +99,28 @@ struct Widget: Identifiable { } } -// Saved widget with options +/// Saved widget with options struct SavedWidget: Codable, Identifiable { let type: WidgetType let optionsData: Data? - // Use type as identifier since only one widget per type is allowed - var id: WidgetType { type } + /// Use type as identifier since only one widget per type is allowed + var id: WidgetType { + type + } init(type: WidgetType, optionsData: Data? = nil) { self.type = type self.optionsData = optionsData } - // Convert to Widget for UI + /// Convert to Widget for UI func toWidget() -> Widget { return Widget(type: type) } } -// Placeholder widget for unimplemented widgets +/// Placeholder widget for unimplemented widgets struct PlaceholderWidget: View { let type: WidgetType let message: String @@ -157,13 +157,13 @@ enum WidgetType: String, CaseIterable, Codable { class WidgetsViewModel: ObservableObject { @Published var savedWidgets: [Widget] = [] - // Single AppStorage key for widgets with their options + /// Single AppStorage key for widgets with their options @AppStorage("savedWidgets") private var savedWidgetsData: Data = .init() - // In-memory storage for saved widgets with options + /// In-memory storage for saved widgets with options private var savedWidgetsWithOptions: [SavedWidget] = [] - // Default widgets for new installs and resets + /// Default widgets for new installs and resets private static let defaultSavedWidgets: [SavedWidget] = [ SavedWidget(type: .price), SavedWidget(type: .news), diff --git a/Bitkit/Views/Settings/Advanced/AddressViewer.swift b/Bitkit/Views/Settings/Advanced/AddressViewer.swift index ae6d8c902..129ec7f84 100644 --- a/Bitkit/Views/Settings/Advanced/AddressViewer.swift +++ b/Bitkit/Views/Settings/Advanced/AddressViewer.swift @@ -46,12 +46,12 @@ struct AddressViewer: View { selectedScriptType.derivationPath } - // Get the first address for QR display + /// Get the first address for QR display private var firstAddress: String { addresses.first?.address ?? "" } - // Get the currently selected address for QR display, fallback to first address + /// Get the currently selected address for QR display, fallback to first address private var displayAddress: String { if !selectedAddress.isEmpty { return selectedAddress @@ -59,7 +59,7 @@ struct AddressViewer: View { return firstAddress } - // Get the index of the currently selected address + /// Get the index of the currently selected address private var selectedAddressIndex: Int { if !selectedAddress.isEmpty, let index = addresses.firstIndex(where: { $0.address == selectedAddress }) diff --git a/Bitkit/Views/Settings/Advanced/CoinSelectionSettingsView.swift b/Bitkit/Views/Settings/Advanced/CoinSelectionSettingsView.swift index 94c45eec5..1567b41d6 100644 --- a/Bitkit/Views/Settings/Advanced/CoinSelectionSettingsView.swift +++ b/Bitkit/Views/Settings/Advanced/CoinSelectionSettingsView.swift @@ -49,7 +49,7 @@ extension CoinSelectionAlgorithm { } } - // Only return supported algorithms from the test + /// Only return supported algorithms from the test static var supportedAlgorithms: [CoinSelectionAlgorithm] { return [.branchAndBound, .largestFirst, .oldestFirst, .singleRandomDraw] } diff --git a/Bitkit/Views/Settings/Advanced/LightningConnectionDetailView.swift b/Bitkit/Views/Settings/Advanced/LightningConnectionDetailView.swift index f260fb488..658f7275e 100644 --- a/Bitkit/Views/Settings/Advanced/LightningConnectionDetailView.swift +++ b/Bitkit/Views/Settings/Advanced/LightningConnectionDetailView.swift @@ -335,7 +335,7 @@ struct LightningConnectionDetailView: View { ) } - // Helper Views + /// Helper Views private func DetailRow(label: String, value: String, valueTestId: String? = nil) -> some View { VStack(alignment: .leading, spacing: 0) { GeometryReader { geometry in diff --git a/Bitkit/Views/Settings/LogView.swift b/Bitkit/Views/Settings/LogView.swift index e1e99be4e..02705c5c9 100644 --- a/Bitkit/Views/Settings/LogView.swift +++ b/Bitkit/Views/Settings/LogView.swift @@ -101,14 +101,17 @@ struct LogView: View { } } -// Model representing a log file +/// Model representing a log file struct LogFile: Identifiable { - var id: String { url.lastPathComponent } + var id: String { + url.lastPathComponent + } + let displayName: String let url: URL } -// View to display the content of a log file +/// View to display the content of a log file struct LogContentView: View { let logFile: LogFile @State private var lines: [String] = [] diff --git a/Bitkit/Views/Settings/Security/PinChangeView.swift b/Bitkit/Views/Settings/Security/PinChangeView.swift index 58564165f..63d7e204e 100644 --- a/Bitkit/Views/Settings/Security/PinChangeView.swift +++ b/Bitkit/Views/Settings/Security/PinChangeView.swift @@ -23,7 +23,7 @@ struct PinChangeView: View { case success } - // Computed properties for title and description + /// Computed properties for title and description var navTitle: String { switch step { case .verifyCurrentPin: diff --git a/Bitkit/Views/Settings/TransactionSpeed/CustomSpeedView.swift b/Bitkit/Views/Settings/TransactionSpeed/CustomSpeedView.swift index 02ec05607..4cdd3e439 100644 --- a/Bitkit/Views/Settings/TransactionSpeed/CustomSpeedView.swift +++ b/Bitkit/Views/Settings/TransactionSpeed/CustomSpeedView.swift @@ -7,7 +7,7 @@ struct CustomSpeedView: View { @State private var feeRate: UInt32 = 0 - // Average transaction size for fee calculation + /// Average transaction size for fee calculation private let avgTransactionSize: UInt32 = 256 // vBytes for typical transaction private var totalFee: UInt64 { diff --git a/Bitkit/Views/Sheets/GiftSheet.swift b/Bitkit/Views/Sheets/GiftSheet.swift index 871362f8b..5e79083d8 100644 --- a/Bitkit/Views/Sheets/GiftSheet.swift +++ b/Bitkit/Views/Sheets/GiftSheet.swift @@ -17,11 +17,6 @@ struct GiftSheetItem: SheetItem { let size: SheetSize = .large let code: String let amount: Int - - init(code: String, amount: Int) { - self.code = code - self.amount = amount - } } struct GiftSheet: View { diff --git a/Bitkit/Views/Sheets/LnurlAuth/LnurlAuthSheet.swift b/Bitkit/Views/Sheets/LnurlAuth/LnurlAuthSheet.swift index b38a2df95..ad7f3eded 100644 --- a/Bitkit/Views/Sheets/LnurlAuth/LnurlAuthSheet.swift +++ b/Bitkit/Views/Sheets/LnurlAuth/LnurlAuthSheet.swift @@ -17,11 +17,6 @@ struct LnurlAuthSheetItem: SheetItem { let size: SheetSize = .large let lnurl: String let authData: LnurlAuthData - - init(lnurl: String, authData: LnurlAuthData) { - self.lnurl = lnurl - self.authData = authData - } } struct LnurlAuthSheet: View { diff --git a/Bitkit/Views/Sheets/Sheet.swift b/Bitkit/Views/Sheets/Sheet.swift index 45c1ba8fa..064eda70d 100644 --- a/Bitkit/Views/Sheets/Sheet.swift +++ b/Bitkit/Views/Sheets/Sheet.swift @@ -96,7 +96,7 @@ struct SheetHeader: View { // MARK: - Generic Reusable Sheet Component -// Base protocol that all sheet items should conform to +/// Base protocol that all sheet items should conform to protocol SheetItem: Identifiable { var size: SheetSize { get } } diff --git a/Bitkit/Views/Shop/ShopDiscover.swift b/Bitkit/Views/Shop/ShopDiscover.swift index 3c36fe259..41ef8d61f 100644 --- a/Bitkit/Views/Shop/ShopDiscover.swift +++ b/Bitkit/Views/Shop/ShopDiscover.swift @@ -1,6 +1,6 @@ import SwiftUI -// Category data structure +/// Category data structure struct ShopCategory: Identifiable { let id = UUID() let title: String @@ -8,7 +8,7 @@ struct ShopCategory: Identifiable { let iconName: String } -// Shop discover cards data +/// Shop discover cards data struct ShopCard: Identifiable { let id = UUID() let title: String @@ -36,7 +36,7 @@ struct ShopDiscover: View { @EnvironmentObject var navigation: NavigationViewModel @State private var selectedTab: ShopTab = .shop - // Categories data + /// Categories data private let categories: [ShopCategory] = [ ShopCategory(title: "Apparel", route: "buy/apparel", iconName: "pedestrian"), ShopCategory(title: "Automobiles", route: "buy/automobiles", iconName: "car"), @@ -62,7 +62,7 @@ struct ShopDiscover: View { ShopCategory(title: "VoIP", route: "buy/voip", iconName: "phone-call"), ] - // Featured cards data + /// Featured cards data private let cards: [ShopCard] = [ ShopCard( title: t("other__shop__discover__gift-cards__title"), diff --git a/Bitkit/Views/Transfer/FundManualConfirmView.swift b/Bitkit/Views/Transfer/FundManualConfirmView.swift index ad7156621..38af19e30 100644 --- a/Bitkit/Views/Transfer/FundManualConfirmView.swift +++ b/Bitkit/Views/Transfer/FundManualConfirmView.swift @@ -9,7 +9,7 @@ struct FundManualConfirmView: View { let lnPeer: LnPeer let amountSats: UInt64 - // Placeholder values - in a real implementation these would be calculated + /// Placeholder values - in a real implementation these would be calculated @State private var networkFeeSat: UInt64 = 0 private func loadFees(refresh: Bool) async { diff --git a/Bitkit/Views/Transfer/FundManualSetupView.swift b/Bitkit/Views/Transfer/FundManualSetupView.swift index 491489e9c..1cf60dabe 100644 --- a/Bitkit/Views/Transfer/FundManualSetupView.swift +++ b/Bitkit/Views/Transfer/FundManualSetupView.swift @@ -20,7 +20,7 @@ struct FundManualSetupView: View { self.initialNodeUri = initialNodeUri } - // Test URI: 028a8910b0048630d4eb17af25668cdd7ea6f2d8ae20956e7a06e2ae46ebcb69fc@34.65.86.104:9400 + /// Test URI: 028a8910b0048630d4eb17af25668cdd7ea6f2d8ae20956e7a06e2ae46ebcb69fc@34.65.86.104:9400 func pasteLightningNodeUri() { guard let pastedText = UIPasteboard.general.string?.trimmingCharacters(in: .whitespacesAndNewlines) else { alertTitle = t("wallet__send_clipboard_empty_title") diff --git a/Bitkit/Views/Transfer/FundManualSuccessView.swift b/Bitkit/Views/Transfer/FundManualSuccessView.swift index 5810c7591..f356f2962 100644 --- a/Bitkit/Views/Transfer/FundManualSuccessView.swift +++ b/Bitkit/Views/Transfer/FundManualSuccessView.swift @@ -4,7 +4,7 @@ struct FundManualSuccessView: View { @EnvironmentObject var app: AppViewModel @EnvironmentObject var navigation: NavigationViewModel - // Keep in state so we don't get a new random text on each render + /// Keep in state so we don't get a new random text on each render @State private var randomOkText: String = localizedRandom("common__ok_random") var body: some View { diff --git a/Bitkit/Views/Transfer/LnurlChannel.swift b/Bitkit/Views/Transfer/LnurlChannel.swift index 96e022ac6..7eca58542 100644 --- a/Bitkit/Views/Transfer/LnurlChannel.swift +++ b/Bitkit/Views/Transfer/LnurlChannel.swift @@ -10,15 +10,14 @@ struct LnurlChannel: View { @State private var isConnecting = false - // Parse the node URI to extract node, host, and port + /// Parse the node URI to extract node, host, and port private var parsedUri: LnPeer { parseNodeUri(channelData.uri) } func parseNodeUri(_ uri: String) -> LnPeer { do { - let lnPeer = try LnPeer(connection: uri) - return lnPeer + return try LnPeer(connection: uri) } catch { Logger.error("Failed to parse node URI: \(uri), error: \(error)") return LnPeer(nodeId: "", host: "", port: 0) diff --git a/Bitkit/Views/Transfer/SavingsConfirmView.swift b/Bitkit/Views/Transfer/SavingsConfirmView.swift index 244074ced..7c7f7681b 100644 --- a/Bitkit/Views/Transfer/SavingsConfirmView.swift +++ b/Bitkit/Views/Transfer/SavingsConfirmView.swift @@ -109,12 +109,7 @@ struct SavingsConfirmView: View { .environmentObject(WalletViewModel()) .environmentObject(AppViewModel()) .environmentObject(CurrencyViewModel()) - .environmentObject( - { - let vm = TransferViewModel() - return vm - }() - ) + .environmentObject(TransferViewModel()) } .preferredColorScheme(.dark) } diff --git a/Bitkit/Views/Transfer/SettingUpView.swift b/Bitkit/Views/Transfer/SettingUpView.swift index 81326603f..409633644 100644 --- a/Bitkit/Views/Transfer/SettingUpView.swift +++ b/Bitkit/Views/Transfer/SettingUpView.swift @@ -123,7 +123,7 @@ struct SettingUpView: View { @EnvironmentObject var navigation: NavigationViewModel @EnvironmentObject var transfer: TransferViewModel - // Keep in state so we don't get a new random text on each render + /// Keep in state so we don't get a new random text on each render @State private var randomOkText: String = localizedRandom("common__ok_random") var isTransferring: Bool { diff --git a/Bitkit/Views/Wallets/Activity/ActivityItemView.swift b/Bitkit/Views/Wallets/Activity/ActivityItemView.swift index 3db604182..fcfdd4372 100644 --- a/Bitkit/Views/Wallets/Activity/ActivityItemView.swift +++ b/Bitkit/Views/Wallets/Activity/ActivityItemView.swift @@ -136,8 +136,7 @@ struct ActivityItemView: View { if activity.txType == .sent { return true } else { - let hasCPFP = activity.boostTxIds.contains { boostTxDoesExist[$0] == true } - return hasCPFP + return activity.boostTxIds.contains { boostTxDoesExist[$0] == true } } } @@ -248,7 +247,6 @@ struct ActivityItemView: View { } } - @ViewBuilder private var statusSection: some View { VStack(alignment: .leading, spacing: 0) { CaptionMText(t("wallet__activity_status")) @@ -313,7 +311,6 @@ struct ActivityItemView: View { } } - @ViewBuilder private var timestampSection: some View { HStack(spacing: 16) { VStack(alignment: .leading, spacing: 0) { @@ -453,7 +450,6 @@ struct ActivityItemView: View { } } - @ViewBuilder private var buttons: some View { VStack(spacing: 16) { HStack(spacing: 16) { diff --git a/Bitkit/Views/Wallets/Activity/AllActivityView.swift b/Bitkit/Views/Wallets/Activity/AllActivityView.swift index 69e42f8ad..4dced49b4 100644 --- a/Bitkit/Views/Wallets/Activity/AllActivityView.swift +++ b/Bitkit/Views/Wallets/Activity/AllActivityView.swift @@ -22,7 +22,7 @@ struct AllActivityView: View { ScrollView(showsIndicators: false) { ActivityList(viewType: .all) - /// Leave some space for TabBar + // Leave some space for TabBar .padding(.bottom, 130) .scrollDismissesKeyboard(.interactively) .highPriorityGesture( diff --git a/Bitkit/Views/Wallets/HomeView.swift b/Bitkit/Views/Wallets/HomeView.swift index 3e7238a6b..2548ee651 100644 --- a/Bitkit/Views/Wallets/HomeView.swift +++ b/Bitkit/Views/Wallets/HomeView.swift @@ -62,7 +62,7 @@ struct HomeView: View { .padding(.top, 32) .padding(.horizontal) } - /// Leave some space for TabBar + // Leave some space for TabBar .padding(.bottom, 130) } } @@ -93,7 +93,7 @@ struct HomeView: View { // Header on top Header() } - /// Dismiss (calculator widget) keyboard when scrolling + // Dismiss (calculator widget) keyboard when scrolling .scrollDismissesKeyboard(.immediately) .animation(.spring(response: 0.3), value: app.showHomeViewEmptyState) .overlay { diff --git a/Bitkit/Views/Wallets/Receive/QrArea.swift b/Bitkit/Views/Wallets/Receive/QrArea.swift index 1b5ff8ece..54bde31b9 100644 --- a/Bitkit/Views/Wallets/Receive/QrArea.swift +++ b/Bitkit/Views/Wallets/Receive/QrArea.swift @@ -111,8 +111,7 @@ struct QrArea: View { // Draw the QR code in the padded area UIImage(cgImage: cgImage).draw(in: qrRect) - let generatedImage = UIGraphicsGetImageFromCurrentImageContext() - return generatedImage + return UIGraphicsGetImageFromCurrentImageContext() } } diff --git a/Bitkit/Views/Wallets/Receive/ReceiveQr.swift b/Bitkit/Views/Wallets/Receive/ReceiveQr.swift index 3c844b039..03d5f3a5f 100644 --- a/Bitkit/Views/Wallets/Receive/ReceiveQr.swift +++ b/Bitkit/Views/Wallets/Receive/ReceiveQr.swift @@ -144,7 +144,6 @@ struct ReceiveQr: View { } } - @ViewBuilder func tabContent(for tab: ReceiveTab) -> some View { VStack(spacing: 0) { if tab == .spending && wallet.channelCount == 0 && cjitInvoice == nil { @@ -228,7 +227,6 @@ struct ReceiveQr: View { } } - @ViewBuilder func detailsContent(for tab: ReceiveTab) -> some View { VStack { let addressPairs: [CopyAddressPair] = { diff --git a/Bitkit/Views/Wallets/SavingsWalletView.swift b/Bitkit/Views/Wallets/SavingsWalletView.swift index bc0dcee1e..2bc549953 100644 --- a/Bitkit/Views/Wallets/SavingsWalletView.swift +++ b/Bitkit/Views/Wallets/SavingsWalletView.swift @@ -61,7 +61,7 @@ struct SavingsWalletView: View { CustomButton(title: t("common__show_all"), variant: .tertiary) { navigation.navigate(.activityList) } - /// Leave some space for TabBar + // Leave some space for TabBar .padding(.bottom, 130) } .accessibilityIdentifier("HomeScrollView") diff --git a/Bitkit/Views/Wallets/Send/SendConfirmationView.swift b/Bitkit/Views/Wallets/Send/SendConfirmationView.swift index 4032a5a0c..67507d75f 100644 --- a/Bitkit/Views/Wallets/Send/SendConfirmationView.swift +++ b/Bitkit/Views/Wallets/Send/SendConfirmationView.swift @@ -19,7 +19,7 @@ struct SendConfirmationView: View { @State private var routingFee: Int = 0 @State private var shouldUseSendAll: Bool = false - // Warning system + /// Warning system private enum WarningType: String, CaseIterable { case amount case balance @@ -395,7 +395,6 @@ struct SendConfirmationView: View { try? await CoreService.shared.activity.addPreActivityMetadata(preActivityMetadata) } - @ViewBuilder func onchainView(_ invoice: OnChainInvoice) -> some View { VStack(alignment: .leading, spacing: 0) { editableInvoiceSection( @@ -461,7 +460,6 @@ struct SendConfirmationView: View { } } - @ViewBuilder func lightningView(_ invoice: LightningInvoice) -> some View { VStack(alignment: .leading, spacing: 0) { editableInvoiceSection( @@ -538,7 +536,6 @@ struct SendConfirmationView: View { } } - @ViewBuilder private func editableInvoiceSection(title: String, value: String) -> some View { Button { navigateToManual(with: value) diff --git a/Bitkit/Views/Wallets/Send/SendSuccess.swift b/Bitkit/Views/Wallets/Send/SendSuccess.swift index bfc7bc167..1672d998a 100644 --- a/Bitkit/Views/Wallets/Send/SendSuccess.swift +++ b/Bitkit/Views/Wallets/Send/SendSuccess.swift @@ -13,7 +13,7 @@ struct SendSuccess: View { @State private var foundActivity: Activity? - // Load the confetti animation + /// Load the confetti animation private var confettiAnimation: LottieAnimation? { let isOnchain = app.selectedWalletToPayFrom == .onchain let animationName = isOnchain ? "confetti-orange" : "confetti-purple" diff --git a/Bitkit/Views/Wallets/Sheets/AddTagSheet.swift b/Bitkit/Views/Wallets/Sheets/AddTagSheet.swift index 35db78d21..ae99deace 100644 --- a/Bitkit/Views/Wallets/Sheets/AddTagSheet.swift +++ b/Bitkit/Views/Wallets/Sheets/AddTagSheet.swift @@ -9,10 +9,6 @@ struct AddTagSheetItem: SheetItem, Equatable { let size: SheetSize = .small let activityId: String - init(activityId: String) { - self.activityId = activityId - } - static func == (lhs: AddTagSheetItem, rhs: AddTagSheetItem) -> Bool { return lhs.activityId == rhs.activityId } diff --git a/Bitkit/Views/Wallets/Sheets/BoostSheet.swift b/Bitkit/Views/Wallets/Sheets/BoostSheet.swift index 41403cef9..6acec72fa 100644 --- a/Bitkit/Views/Wallets/Sheets/BoostSheet.swift +++ b/Bitkit/Views/Wallets/Sheets/BoostSheet.swift @@ -11,10 +11,6 @@ struct BoostSheetItem: SheetItem, Equatable { let size: SheetSize = .small let onchainActivity: OnchainActivity - init(onchainActivity: OnchainActivity) { - self.onchainActivity = onchainActivity - } - static func == (lhs: BoostSheetItem, rhs: BoostSheetItem) -> Bool { return lhs.onchainActivity.id == rhs.onchainActivity.id } @@ -43,7 +39,9 @@ struct BoostSheet: View { } // TODO: get real estimation - private var estimatedTxSize: UInt64 { 250 } + private var estimatedTxSize: UInt64 { + 250 + } private var currentFeeRate: UInt32 { return isEditingFee ? (editedFeeRate ?? feeRate ?? 0) : (feeRate ?? 0) diff --git a/Bitkit/Views/Wallets/Sheets/ReceivedTx.swift b/Bitkit/Views/Wallets/Sheets/ReceivedTx.swift index cbfa2ff7c..13aa79cdb 100644 --- a/Bitkit/Views/Wallets/Sheets/ReceivedTx.swift +++ b/Bitkit/Views/Wallets/Sheets/ReceivedTx.swift @@ -22,10 +22,10 @@ struct ReceivedTx: View { @EnvironmentObject private var sheets: SheetViewModel - // Keep in state so we don't get a new random text on each render + /// Keep in state so we don't get a new random text on each render @State private var buttonText: String = localizedRandom("common__ok_random") - // Load the confetti animation + /// Load the confetti animation private var confettiAnimation: LottieAnimation? { let isOnchain = config.details.type == .onchain let animationName = isOnchain ? "confetti-orange" : "confetti-purple" diff --git a/Bitkit/Views/Wallets/SpendingWalletView.swift b/Bitkit/Views/Wallets/SpendingWalletView.swift index d59e7d241..eeeb366b9 100644 --- a/Bitkit/Views/Wallets/SpendingWalletView.swift +++ b/Bitkit/Views/Wallets/SpendingWalletView.swift @@ -46,7 +46,7 @@ struct SpendingWalletView: View { CustomButton(title: t("common__show_all"), variant: .tertiary) { navigation.navigate(.activityList) } - /// Leave some space for TabBar + // Leave some space for TabBar .padding(.bottom, 130) } .accessibilityIdentifier("HomeScrollView") diff --git a/Bitkit/Views/Widgets/WidgetDetailView.swift b/Bitkit/Views/Widgets/WidgetDetailView.swift index 409b1182b..74abebdc3 100644 --- a/Bitkit/Views/Widgets/WidgetDetailView.swift +++ b/Bitkit/Views/Widgets/WidgetDetailView.swift @@ -7,10 +7,10 @@ struct WidgetDetailView: View { @EnvironmentObject private var widgets: WidgetsViewModel let id: WidgetType - // State for managing widget actions + /// State for managing widget actions @State private var showDeleteAlert = false - // Widget data computed from the ID + /// Widget data computed from the ID private var widget: (name: String, description: String, icon: String) { let name = t("widgets__\(id.rawValue)__name") @@ -22,12 +22,12 @@ struct WidgetDetailView: View { return (name: name, description: description, icon: icon) } - // Check if widget is already saved (for showing delete button) + /// Check if widget is already saved (for showing delete button) private var isWidgetSaved: Bool { widgets.isWidgetSaved(id) } - // Check if widget has customization options + /// Check if widget has customization options private var hasOptions: Bool { switch id { case .blocks, .facts, .news, .price, .weather: @@ -37,7 +37,7 @@ struct WidgetDetailView: View { } } - // Check if widget has custom options + /// Check if widget has custom options private var hasCustomOptions: Bool { widgets.hasCustomOptions(for: id) } diff --git a/Bitkit/Views/Widgets/WidgetEditModels.swift b/Bitkit/Views/Widgets/WidgetEditModels.swift index 9f5fc24b0..46699a56d 100644 --- a/Bitkit/Views/Widgets/WidgetEditModels.swift +++ b/Bitkit/Views/Widgets/WidgetEditModels.swift @@ -22,7 +22,7 @@ struct WidgetEditItem { self.isChecked = isChecked } - // Convenience initializer for string titles and values + /// Convenience initializer for string titles and values init(key: String, type: WidgetItemType, title: String, value: String? = nil, isChecked: Bool) { self.key = key self.type = type @@ -31,7 +31,7 @@ struct WidgetEditItem { self.isChecked = isChecked } - // Convenience initializer for string titles and view values + /// Convenience initializer for string titles and view values init(key: String, type: WidgetItemType, title: String, valueView: AnyView? = nil, isChecked: Bool) { self.key = key self.type = type diff --git a/Bitkit/Views/Widgets/WidgetEditView.swift b/Bitkit/Views/Widgets/WidgetEditView.swift index 1a8745c75..8cfc81174 100644 --- a/Bitkit/Views/Widgets/WidgetEditView.swift +++ b/Bitkit/Views/Widgets/WidgetEditView.swift @@ -20,7 +20,7 @@ struct WidgetEditView: View { @StateObject private var priceViewModel = PriceViewModel.shared @StateObject private var weatherViewModel = WeatherViewModel.shared - // Widget data computed from the ID + /// Widget data computed from the ID private var widget: (name: String, description: String, icon: String) { let name = t("widgets__\(id.rawValue)__name") let fiatSymbol = currency.symbol diff --git a/BitkitTests/ActivityListTest.swift b/BitkitTests/ActivityListTest.swift index 541939ef9..dcf40ed93 100644 --- a/BitkitTests/ActivityListTest.swift +++ b/BitkitTests/ActivityListTest.swift @@ -1,8 +1,7 @@ +@testable import Bitkit import BitkitCore import XCTest -@testable import Bitkit - final class ActivityTests: XCTestCase { let testDbPath = NSTemporaryDirectory() let service = CoreService.shared.activity diff --git a/BitkitTests/AddressTypeIntegrationTests.swift b/BitkitTests/AddressTypeIntegrationTests.swift index e66a8f2e8..ed106c44d 100644 --- a/BitkitTests/AddressTypeIntegrationTests.swift +++ b/BitkitTests/AddressTypeIntegrationTests.swift @@ -1,9 +1,8 @@ +@testable import Bitkit import BitkitCore import LDKNode import XCTest -@testable import Bitkit - final class AddressTypeIntegrationTests: XCTestCase { let walletIndex = 0 let settings = SettingsViewModel.shared diff --git a/BitkitTests/AddressTypeSettingsTests.swift b/BitkitTests/AddressTypeSettingsTests.swift index d81bf5c39..a68c34b78 100644 --- a/BitkitTests/AddressTypeSettingsTests.swift +++ b/BitkitTests/AddressTypeSettingsTests.swift @@ -1,9 +1,8 @@ +@testable import Bitkit import Combine import LDKNode import XCTest -@testable import Bitkit - /// Tests for the multi-address-type feature in SettingsViewModel. /// Covers address type conversion, monitoring, native witness rules, and backup/restore. @MainActor diff --git a/BitkitTests/ChannelDetailsViewModelTests.swift b/BitkitTests/ChannelDetailsViewModelTests.swift index 7dec670a8..48555db28 100644 --- a/BitkitTests/ChannelDetailsViewModelTests.swift +++ b/BitkitTests/ChannelDetailsViewModelTests.swift @@ -1,8 +1,7 @@ +@testable import Bitkit import BitkitCore import XCTest -@testable import Bitkit - final class ChannelDetailsViewModelTests: XCTestCase { @MainActor func testPendingOrdersFiltersByPaidIdsAndState() { @@ -13,7 +12,7 @@ final class ChannelDetailsViewModelTests: XCTestCase { let expiredPaid = makeOrder(id: "expiredPaid", state2: .expired) let orders = [createdPaid, paidPaid, createdUnpaid, executedPaid, expiredPaid] - let paidOrderIds: Set = ["createdPaid", "paidPaid", "executedPaid", "expiredPaid"] + let paidOrderIds: Set = ["createdPaid", "paidPaid", "executedPaid", "expiredPaid"] let result = ChannelDetailsViewModel.pendingOrders( orders: orders, diff --git a/BitkitTests/ChannelPurchaseFlow.swift b/BitkitTests/ChannelPurchaseFlow.swift index cfe52c6d8..d100e7663 100644 --- a/BitkitTests/ChannelPurchaseFlow.swift +++ b/BitkitTests/ChannelPurchaseFlow.swift @@ -1,8 +1,7 @@ +@testable import Bitkit import BitkitCore import XCTest -@testable import Bitkit - final class PaymentFlowTests: XCTestCase { let testDbPath = NSTemporaryDirectory() let walletIndex = 0 diff --git a/BitkitTests/CryptoTests.swift b/BitkitTests/CryptoTests.swift index c674af147..ef9b8e6cd 100644 --- a/BitkitTests/CryptoTests.swift +++ b/BitkitTests/CryptoTests.swift @@ -43,7 +43,7 @@ final class CryptoTests: XCTestCase { // Message to encrypt let originalMessage = "Hello, secure world!" - let messageData = originalMessage.data(using: .utf8)! + let messageData = try XCTUnwrap(originalMessage.data(using: .utf8)) // Encrypt the message using Alice's shared secret let encryptedData = try Crypto.encrypt(messageData, secretKey: aliceSharedSecret) diff --git a/BitkitTests/LdkMigration.swift b/BitkitTests/LdkMigration.swift index 6c07a9291..b67bce750 100644 --- a/BitkitTests/LdkMigration.swift +++ b/BitkitTests/LdkMigration.swift @@ -12,7 +12,7 @@ final class LdkMigrationTests: XCTestCase { dumpLdkLogs() } - func testLdkToLdkNode() async throws { + func testLdkToLdkNode() { // try Keychain.wipeEntireKeychain() // try await LightningService.shared.wipeStorage(walletIndex: walletIndex) // diff --git a/BitkitTests/RNMigrationAddressTypeTests.swift b/BitkitTests/RNMigrationAddressTypeTests.swift index 3eef7fa86..e8fc26939 100644 --- a/BitkitTests/RNMigrationAddressTypeTests.swift +++ b/BitkitTests/RNMigrationAddressTypeTests.swift @@ -104,20 +104,20 @@ final class RNMigrationAddressTypeTests: XCTestCase { XCTAssertEqual(UserDefaults.standard.string(forKey: "addressTypesToMonitor"), "nativeSegwit,taproot") } - func testApplyRNAddressTypeSettingsNativeWitnessAdded() { + func testApplyRNAddressTypeSettingsNativeWitnessAdded() throws { migrations.applyRNAddressTypeSettings(selectedAddressType: nil, addressTypesToMonitor: ["legacy"]) let monitored = UserDefaults.standard.string(forKey: "addressTypesToMonitor") XCTAssertNotNil(monitored) - XCTAssertTrue(monitored!.contains("nativeSegwit")) - XCTAssertTrue(monitored!.contains("legacy")) + XCTAssertTrue(try XCTUnwrap(monitored?.contains("nativeSegwit"))) + XCTAssertTrue(try XCTUnwrap(monitored?.contains("legacy"))) } - func testApplyRNAddressTypeSettingsNestedSegwitOnlyAddsNativeSegwit() { + func testApplyRNAddressTypeSettingsNestedSegwitOnlyAddsNativeSegwit() throws { migrations.applyRNAddressTypeSettings(selectedAddressType: nil, addressTypesToMonitor: ["nestedSegwit"]) let monitored = UserDefaults.standard.string(forKey: "addressTypesToMonitor") XCTAssertNotNil(monitored) - XCTAssertTrue(monitored!.contains("nativeSegwit")) - XCTAssertTrue(monitored!.contains("nestedSegwit")) + XCTAssertTrue(try XCTUnwrap(monitored?.contains("nativeSegwit"))) + XCTAssertTrue(try XCTUnwrap(monitored?.contains("nestedSegwit"))) } func testApplyRNAddressTypeSettingsWithNativeWitnessDoesNotDuplicate() { diff --git a/BitkitTests/RNMigrationCleanupTests.swift b/BitkitTests/RNMigrationCleanupTests.swift index cf67a1aa3..4f5a3217b 100644 --- a/BitkitTests/RNMigrationCleanupTests.swift +++ b/BitkitTests/RNMigrationCleanupTests.swift @@ -9,10 +9,10 @@ final class RNMigrationCleanupTests: XCTestCase { private let migrations = MigrationsService.shared private let fileManager = FileManager.default - // RN wallet name used by the migration service + /// RN wallet name used by the migration service private let rnWalletName = "wallet0" - // Sandbox Documents directory (where RN stored its data) + /// Sandbox Documents directory (where RN stored its data) private var sandboxDocuments: URL { FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] } @@ -123,16 +123,16 @@ final class RNMigrationCleanupTests: XCTestCase { // MARK: - RN Keychain Cleanup Tests - func testCleanupRNKeychainDeletesEntries() { + func testCleanupRNKeychainDeletesEntries() throws { // Setup: Create RN keychain entries createRNKeychainEntry(walletName: rnWalletName, mnemonic: "test mnemonic") // Also create passphrase entry - let passphraseQuery: [String: Any] = [ + let passphraseQuery: [String: Any] = try [ kSecClass as String: kSecClassGenericPassword, kSecAttrService as String: "\(rnWalletName)passphrase", kSecAttrAccount as String: "\(rnWalletName)passphrase", - kSecValueData as String: "test passphrase".data(using: .utf8)!, + kSecValueData as String: XCTUnwrap("test passphrase".data(using: .utf8)), ] SecItemAdd(passphraseQuery as CFDictionary, nil) diff --git a/BitkitTests/TransferViewModelTests.swift b/BitkitTests/TransferViewModelTests.swift index 2a0acedd5..dac9f5f38 100644 --- a/BitkitTests/TransferViewModelTests.swift +++ b/BitkitTests/TransferViewModelTests.swift @@ -1,8 +1,7 @@ +@testable import Bitkit import BitkitCore import XCTest -@testable import Bitkit - final class TransferViewModelTests: XCTestCase { @MainActor func testDisplayOrderPrefersUiStateOrder() { diff --git a/BitkitTests/UtxoSelectionTests.swift b/BitkitTests/UtxoSelectionTests.swift index 9e0e6c053..d228de813 100644 --- a/BitkitTests/UtxoSelectionTests.swift +++ b/BitkitTests/UtxoSelectionTests.swift @@ -1,9 +1,8 @@ +@testable import Bitkit import BitkitCore import LDKNode import XCTest -@testable import Bitkit - final class UtxoSelectionTests: XCTestCase { let testDbPath = NSTemporaryDirectory() let walletIndex = 0 diff --git a/BitkitUITests/BitkitUITests.swift b/BitkitUITests/BitkitUITests.swift index b0311228a..eda868bca 100644 --- a/BitkitUITests/BitkitUITests.swift +++ b/BitkitUITests/BitkitUITests.swift @@ -15,7 +15,7 @@ final class BitkitUITests: XCTestCase { // Put teardown code here. This method is called after the invocation of each test method in the class. } - func testExample() throws { + func testExample() { // UI tests must launch the application that they test. let app = XCUIApplication() app.launch() @@ -23,7 +23,7 @@ final class BitkitUITests: XCTestCase { // Use XCTAssert and related functions to verify your tests produce the correct results. } - func testLaunchPerformance() throws { + func testLaunchPerformance() { if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { // This measures how long it takes to launch your application. measure(metrics: [XCTApplicationLaunchMetric()]) { diff --git a/BitkitUITests/BitkitUITestsLaunchTests.swift b/BitkitUITests/BitkitUITestsLaunchTests.swift index 25c9c71b8..8f59e9dd1 100644 --- a/BitkitUITests/BitkitUITestsLaunchTests.swift +++ b/BitkitUITests/BitkitUITestsLaunchTests.swift @@ -9,7 +9,7 @@ final class BitkitUITestsLaunchTests: XCTestCase { continueAfterFailure = false } - func testLaunch() throws { + func testLaunch() { let app = XCUIApplication() app.launch()