Skip to content

Commit 077b7c2

Browse files
committed
initial commit
0 parents  commit 077b7c2

34 files changed

+1208
-0
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.build
2+
DerivedData
3+
/.previous-build
4+
xcuserdata
5+
.DS_Store
6+
*~
7+
\#*
8+
.\#*
9+
.*.sw[nop]
10+
*.xcscmblueprint
11+
/default.profraw
12+
*.xcodeproj
13+
Utilities/Docker/*.tar.gz
14+
.swiftpm
15+
Package.resolved
16+
/build
17+
*.pyc
18+
.docc-build
19+
.vscode
20+
Utilities/InstalledSwiftPMConfiguration/config.json

Package.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// swift-tools-version:5.5
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "NetworkViewer",
8+
platforms: [.iOS(.v14)],
9+
products: [
10+
// Products define the executables and libraries a package produces, and make them visible to other packages.
11+
.library(
12+
name: "NetworkViewer",
13+
targets: ["NetworkViewer"]
14+
),
15+
],
16+
dependencies: [],
17+
targets: [
18+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
19+
// Targets can depend on other targets in this package, and on products in packages this package depends on.
20+
.target(
21+
name: "NetworkViewer",
22+
dependencies: [],
23+
resources: [
24+
.process("Resources"),
25+
]
26+
)
27+
]
28+
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// RainbowDebugModifier.swift
3+
//
4+
// Created by Sakhabaev Egor on 29.10.2023.
5+
//
6+
7+
import Foundation
8+
import SwiftUI
9+
10+
private let rainbowDebugColors = [Color.purple, Color.blue, Color.green, Color.yellow, Color.orange, Color.red]
11+
12+
public extension View {
13+
14+
/// Useful modifier for debugging view redrawing
15+
@ViewBuilder
16+
func rainbowDebug() -> some View {
17+
if ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" {
18+
background(rainbowDebugColors.randomElement()!)
19+
} else {
20+
self
21+
}
22+
}
23+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// Extension+EdgeInsets.swift
3+
//
4+
// Created by Sakhabaev Egor on 29.10.2023.
5+
//
6+
7+
import Foundation
8+
import SwiftUI
9+
10+
public extension EdgeInsets {
11+
12+
static var zero: EdgeInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 0)
13+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// HideScrollndicatorsViewModifier.swift
3+
//
4+
// Created by Sakhabaev Egor on 23.10.2023.
5+
//
6+
7+
import Foundation
8+
import SwiftUI
9+
10+
public struct HideScrollndicatorsModifier: ViewModifier {
11+
12+
@ViewBuilder
13+
public func body(content: Content) -> some View {
14+
if #available(iOS 16.0, *) {
15+
content
16+
.scrollIndicators(.hidden)
17+
} else {
18+
content
19+
}
20+
}
21+
}
22+
23+
public extension View {
24+
25+
func hideScrollIndicators() -> some View {
26+
modifier(HideScrollndicatorsModifier())
27+
}
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// StandardListPaddingModifier.swift
3+
//
4+
// Created by Sakhabaev Egor on 29.10.2023.
5+
//
6+
7+
import Foundation
8+
import SwiftUI
9+
10+
public struct StandardListPaddingModifier: ViewModifier {
11+
12+
public func body(content: Content) -> some View {
13+
content
14+
.listRowInsets(.zero)
15+
.padding(.init(top: 11, leading: 16, bottom: 11, trailing: 16))
16+
}
17+
}
18+
19+
public extension View {
20+
21+
func standardListPadding() -> some View {
22+
modifier(StandardListPaddingModifier())
23+
}
24+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// StandardShadow.swift
3+
//
4+
// Created by Sakhabaev Egor on 15.10.2023.
5+
//
6+
7+
import Foundation
8+
import SwiftUI
9+
10+
public struct StandardShadowModifier: ViewModifier {
11+
12+
public func body(content: Content) -> some View {
13+
content
14+
.shadow(color: .black.opacity(0.2), radius: 4, x: 0.0, y: 1.0)
15+
}
16+
}
17+
18+
public extension View {
19+
20+
func standardShadow() -> some View {
21+
modifier(StandardShadowModifier())
22+
}
23+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// TintModifier.swift
3+
//
4+
// Created by Sakhabaev Egor on 29.10.2023.
5+
//
6+
7+
import Foundation
8+
import SwiftUI
9+
10+
/// Wrapper for .tint iOS 16+.
11+
public struct TintModifier: ViewModifier {
12+
13+
public var color: Color
14+
15+
public func body(content: Content) -> some View {
16+
if #available(iOS 16.0, *) {
17+
content.tint(color)
18+
} else {
19+
content
20+
}
21+
}
22+
}
23+
24+
public extension View {
25+
26+
/// Wrapper for .tint iOS 16+.
27+
func tintColor(_ color: Color) -> some View {
28+
modifier(TintModifier(color: color))
29+
}
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// ViewDidLoadModifier.swift
3+
//
4+
// Created by Sakhabaev Egor on 09.11.2023.
5+
//
6+
7+
import Foundation
8+
import SwiftUI
9+
10+
struct ViewDidLoadModifier: ViewModifier {
11+
12+
@State private var viewDidLoad = false
13+
let action: (() -> Void)?
14+
15+
func body(content: Content) -> some View {
16+
content
17+
.onAppear {
18+
guard !viewDidLoad else { return }
19+
viewDidLoad = true
20+
action?()
21+
}
22+
}
23+
}
24+
25+
extension View {
26+
27+
func onLoad(perform action: (() -> Void)? = nil) -> some View {
28+
modifier(ViewDidLoadModifier(action: action))
29+
}
30+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// RowIdentifible.swift
3+
//
4+
// Created by Sakhabaev Egor on 23.10.2023.
5+
//
6+
7+
import Foundation
8+
9+
public protocol RowIdentifible: Identifiable {
10+
11+
var id: String { get set }
12+
}

0 commit comments

Comments
 (0)