Skip to content

Commit 1cf5064

Browse files
committed
Initial Commit
0 parents  commit 1cf5064

File tree

13 files changed

+868
-0
lines changed

13 files changed

+868
-0
lines changed

Tunelabs.xcodeproj/project.pbxproj

Lines changed: 597 additions & 0 deletions
Large diffs are not rendered by default.

Tunelabs.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"platform" : "ios",
6+
"size" : "1024x1024"
7+
}
8+
],
9+
"info" : {
10+
"author" : "xcode",
11+
"version" : 1
12+
}
13+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}

Tunelabs/ContentView.swift

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// ContentView.swift
3+
// Tunelabs
4+
//
5+
// Created by Daniil Lebedev on 25/03/2025.
6+
//
7+
8+
import SwiftUI
9+
import SwiftData
10+
11+
struct ContentView: View {
12+
@Environment(\.modelContext) private var modelContext
13+
@Query private var items: [Item]
14+
15+
var body: some View {
16+
NavigationSplitView {
17+
List {
18+
ForEach(items) { item in
19+
NavigationLink {
20+
Text("Item at \(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))")
21+
} label: {
22+
Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))
23+
}
24+
}
25+
.onDelete(perform: deleteItems)
26+
}
27+
.toolbar {
28+
ToolbarItem(placement: .navigationBarTrailing) {
29+
EditButton()
30+
}
31+
ToolbarItem {
32+
Button(action: addItem) {
33+
Label("Add Item", systemImage: "plus")
34+
}
35+
}
36+
}
37+
} detail: {
38+
Text("Select an item")
39+
}
40+
}
41+
42+
private func addItem() {
43+
withAnimation {
44+
let newItem = Item(timestamp: Date())
45+
modelContext.insert(newItem)
46+
}
47+
}
48+
49+
private func deleteItems(offsets: IndexSet) {
50+
withAnimation {
51+
for index in offsets {
52+
modelContext.delete(items[index])
53+
}
54+
}
55+
}
56+
}
57+
58+
#Preview {
59+
ContentView()
60+
.modelContainer(for: Item.self, inMemory: true)
61+
}

Tunelabs/Item.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// Item.swift
3+
// Tunelabs
4+
//
5+
// Created by Daniil Lebedev on 25/03/2025.
6+
//
7+
8+
import Foundation
9+
import SwiftData
10+
11+
@Model
12+
final class Item {
13+
var timestamp: Date
14+
15+
init(timestamp: Date) {
16+
self.timestamp = timestamp
17+
}
18+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}

Tunelabs/TunelabsApp.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// TunelabsApp.swift
3+
// Tunelabs
4+
//
5+
// Created by Daniil Lebedev on 25/03/2025.
6+
//
7+
8+
import SwiftUI
9+
import SwiftData
10+
11+
@main
12+
struct TunelabsApp: App {
13+
var sharedModelContainer: ModelContainer = {
14+
let schema = Schema([
15+
Item.self,
16+
])
17+
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
18+
19+
do {
20+
return try ModelContainer(for: schema, configurations: [modelConfiguration])
21+
} catch {
22+
fatalError("Could not create ModelContainer: \(error)")
23+
}
24+
}()
25+
26+
var body: some Scene {
27+
WindowGroup {
28+
ContentView()
29+
}
30+
.modelContainer(sharedModelContainer)
31+
}
32+
}

TunelabsTests/TunelabsTests.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// TunelabsTests.swift
3+
// TunelabsTests
4+
//
5+
// Created by Daniil Lebedev on 25/03/2025.
6+
//
7+
8+
import XCTest
9+
@testable import Tunelabs
10+
11+
final class TunelabsTests: XCTestCase {
12+
13+
override func setUpWithError() throws {
14+
// Put setup code here. This method is called before the invocation of each test method in the class.
15+
}
16+
17+
override func tearDownWithError() throws {
18+
// Put teardown code here. This method is called after the invocation of each test method in the class.
19+
}
20+
21+
func testExample() throws {
22+
// This is an example of a functional test case.
23+
// Use XCTAssert and related functions to verify your tests produce the correct results.
24+
// Any test you write for XCTest can be annotated as throws and async.
25+
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
26+
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
27+
}
28+
29+
func testPerformanceExample() throws {
30+
// This is an example of a performance test case.
31+
self.measure {
32+
// Put the code you want to measure the time of here.
33+
}
34+
}
35+
36+
}

TunelabsUITests/TunelabsUITests.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// TunelabsUITests.swift
3+
// TunelabsUITests
4+
//
5+
// Created by Daniil Lebedev on 25/03/2025.
6+
//
7+
8+
import XCTest
9+
10+
final class TunelabsUITests: XCTestCase {
11+
12+
override func setUpWithError() throws {
13+
// Put setup code here. This method is called before the invocation of each test method in the class.
14+
15+
// In UI tests it is usually best to stop immediately when a failure occurs.
16+
continueAfterFailure = false
17+
18+
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
19+
}
20+
21+
override func tearDownWithError() throws {
22+
// Put teardown code here. This method is called after the invocation of each test method in the class.
23+
}
24+
25+
func testExample() throws {
26+
// UI tests must launch the application that they test.
27+
let app = XCUIApplication()
28+
app.launch()
29+
30+
// Use XCTAssert and related functions to verify your tests produce the correct results.
31+
}
32+
33+
func testLaunchPerformance() throws {
34+
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
35+
// This measures how long it takes to launch your application.
36+
measure(metrics: [XCTApplicationLaunchMetric()]) {
37+
XCUIApplication().launch()
38+
}
39+
}
40+
}
41+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// TunelabsUITestsLaunchTests.swift
3+
// TunelabsUITests
4+
//
5+
// Created by Daniil Lebedev on 25/03/2025.
6+
//
7+
8+
import XCTest
9+
10+
final class TunelabsUITestsLaunchTests: XCTestCase {
11+
12+
override class var runsForEachTargetApplicationUIConfiguration: Bool {
13+
true
14+
}
15+
16+
override func setUpWithError() throws {
17+
continueAfterFailure = false
18+
}
19+
20+
func testLaunch() throws {
21+
let app = XCUIApplication()
22+
app.launch()
23+
24+
// Insert steps here to perform after app launch but before taking a screenshot,
25+
// such as logging into a test account or navigating somewhere in the app
26+
27+
let attachment = XCTAttachment(screenshot: app.screenshot())
28+
attachment.name = "Launch Screen"
29+
attachment.lifetime = .keepAlways
30+
add(attachment)
31+
}
32+
}

0 commit comments

Comments
 (0)