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
8 changes: 8 additions & 0 deletions App/AppCore/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
27 changes: 27 additions & 0 deletions App/AppCore/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "AppCore",
platforms: [.iOS(.v17)],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "AppCore",
targets: ["AppCore"]
)
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "AppCore"
),
.testTarget(
name: "AppCoreTests",
dependencies: ["AppCore"]
),
]
)
29 changes: 29 additions & 0 deletions App/AppCore/Sources/AppCore/AppView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// AppView.swift
//
//
// Created by Jay on 1/12/24.
//

import SwiftUI

public struct AppView: View {
public init() {}
public var body: some View {
TabView {
ForEach(Tab.allCases) { tab in
tab.view
.tabItem {
Label(
title: { Text(tab.label) },
icon: { Image(systemName: tab.icon) }
)
}
}
}
}
}

#Preview {
AppView()
}
48 changes: 48 additions & 0 deletions App/AppCore/Sources/AppCore/Tabs.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// Tabs.swift
//
//
// Created by Jay on 1/12/24.
//

import Foundation
import SwiftUI

enum Tab: Int, Identifiable, CaseIterable {
var id: Int {
self.rawValue
}

case coffee, settings

/// Label for the tab
var label: String {
switch self {
case .coffee:
"Coffee"
case .settings:
"Settings"
}
}

/// SF Symbol for tab icon
var icon: String {
switch self {
case .coffee:
"bag"
case .settings:
"gear"
}
}

/// Root view of the selected tab
@ViewBuilder
var view: some View {
switch self {
case .coffee:
Text(self.label)
case .settings:
Text(self.label)
}
}
}
13 changes: 13 additions & 0 deletions App/AppCore/Tests/AppCoreTests/AppCoreTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import XCTest

@testable import AppCore

final class AppCoreTests: XCTestCase {
func testExample() throws {
// XCTest Documentation
// https://developer.apple.com/documentation/xctest

// Defining Test Cases and Test Methods
// https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
}
}
Loading