Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions NetworkDebugger.podspec

This file was deleted.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PackageDescription

let package = Package(
name: "NetworkDebugger",
platforms: [.iOS(.v14)],
platforms: [.iOS(.v16)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
### Swift Package Manager
Install through the Swift Package Manager using Xcode.

### Cocoa Pods
Add to your `podfile` and install using `pod install`.
```ruby
pod 'NetworkDebugger', '1.0.2'
```

## Setup
In order for the package to work properly, you need to call `start()` as the first method in your `AppDelegate`! (For SwiftUI apps you need to use `@UIApplicationDelegateAdaptor`)
**Note:** It is highly encouraged to only call `start()` in debug or testing environments and **not** in production.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,10 @@ import UIKit

extension UIApplication {
var ndKeyWindow: UIWindow? {
if #available(iOS 15.0, *) {
return connectedScenes
.sorted { $0.sceneOrder < $1.sceneOrder }
.compactMap { $0 as? UIWindowScene }
.compactMap { $0.keyWindow }
.first
}
return connectedScenes
connectedScenes
.sorted { $0.sceneOrder < $1.sceneOrder }
.compactMap { $0 as? UIWindowScene }
.compactMap { $0.windows.first { $0.isKeyWindow }}
.compactMap { $0.keyWindow }
.first
}
}
12 changes: 2 additions & 10 deletions Sources/NetworkDebugger/Extensions/URL+NetworkDebugger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,10 @@ import Foundation

extension URL {
var ndHost: String {
if #available(iOS 16.0, *) {
return host(percentEncoded: false) ?? "N/A"
} else {
return host ?? "N/A"
}
host(percentEncoded: false) ?? "N/A"
}

var ndPath: String {
if #available(iOS 16.0, *) {
return path(percentEncoded: false)
} else {
return path
}
path(percentEncoded: false)
}
}
23 changes: 0 additions & 23 deletions Sources/NetworkDebugger/Extensions/View+NavigationBarVisible.swift

This file was deleted.

31 changes: 0 additions & 31 deletions Sources/NetworkDebugger/Extensions/View+Searchable.swift

This file was deleted.

38 changes: 0 additions & 38 deletions Sources/NetworkDebugger/UI/Components/NavigationStack.swift

This file was deleted.

1 change: 0 additions & 1 deletion Sources/NetworkDebugger/UI/Views/Models/ModelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ struct ModelView: View {
currentPage
Spacer()
}
.ensureNavigationBarVisible()
}

@ViewBuilder
Expand Down
49 changes: 18 additions & 31 deletions Sources/NetworkDebugger/UI/Views/NetworkDebuggerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,57 +50,44 @@ public struct NetworkDebuggerView: View {
}
}
.sheet(isPresented: $isStatisticsPresented) {
if #available(iOS 16.0, *) {
NavigationStack {
StatisticsView()
.navigationTitle("Statistics")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button("Done") {
isStatisticsPresented = false
}
NavigationStack {
StatisticsView()
.navigationTitle("Statistics")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button("Done") {
isStatisticsPresented = false
}
}
}
}
}
}
.toolbar {
isSettingsPresented = true
} statistics: {
isStatisticsPresented = true
}
.ensureNavigationBarVisible()
}
.environmentObject(modelsService)
.environmentObject(settingsService)
.environmentObject(statisticsService)
.searchable(searchText: $searchText)
.searchable(text: $searchText)
}
}

private extension View {
func toolbar(settings: @escaping () -> Void, statistics: @escaping () -> Void) -> some View {
if #available(iOS 16.0, *) {
return self.toolbar {
ToolbarItem(placement: .primaryAction) {
Button("Settings") {
settings()
}
}
ToolbarItem(placement: .cancellationAction) {
Button("Statistics") {
statistics()

}
toolbar {
ToolbarItem(placement: .primaryAction) {
Button("Settings") {
settings()
}
}
} else {
return self.toolbar {
ToolbarItem(placement: .primaryAction) {
Button("Settings") {
settings()
}
ToolbarItem(placement: .cancellationAction) {
Button("Statistics") {
statistics()

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,5 @@ struct SettingsView: View {
Text("There's nothing here (yet)")
}
}
.ensureNavigationBarVisible()
}
}
3 changes: 0 additions & 3 deletions Sources/NetworkDebugger/UI/Views/Statistics/ChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fileprivate enum ChartViewConstants {
static let BAR_HEIGHT: CGFloat = 50
}

@available(iOS 16.0, *)
struct ChartView<Content: View, Subview: View>: View {
typealias Key = String
typealias Value = Double
Expand Down Expand Up @@ -70,7 +69,6 @@ struct ChartView<Content: View, Subview: View>: View {
}
.navigationTitle(statisticsService.selectedHost)
.navigationBarTitleDisplayMode(.inline)
.ensureNavigationBarVisible()
}
}
}
Expand Down Expand Up @@ -120,7 +118,6 @@ struct ChartView<Content: View, Subview: View>: View {
}
}

@available(iOS 16.0, *)
extension ChartView where Subview == EmptyView {
init(limitedHeight: Bool, elements: Dictionary<Key, Value>, @ViewBuilder annotationForKey: @escaping (Key) -> Content) {
self.init(limitedHeight: limitedHeight, elements: elements, annotationForKey: annotationForKey, hasSubview: false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Charts
import SwiftUI

@available(iOS 16.0, *)
struct StatisticsView: View {
@EnvironmentObject var modelsService: ModelsService
@EnvironmentObject var statisticsService: StatisticsService
Expand Down Expand Up @@ -46,7 +45,6 @@ struct StatisticsView: View {
}
}
.navigationTitle("Statistics")
.ensureNavigationBarVisible()
}

private var amountOfRequests: some View {
Expand Down