Skip to content

Commit

Permalink
Initial package structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Mar 30, 2024
1 parent db884e5 commit bd2220a
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [mattmassicotte]
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'CODE_OF_CONDUCT.md'
- '.editorconfig'
- '.spi.yml'
pull_request:
branches:
- main

env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer

jobs:
test:
name: Test
runs-on: macOS-13
strategy:
matrix:
destination:
- "platform=macOS"
- "platform=macOS,variant=Mac Catalyst"
- "platform=iOS Simulator,name=iPhone 11"
- "platform=tvOS Simulator,name=Apple TV"
- "platform=visionOS Simulator,name=Apple Vision Pro"

steps:
- uses: actions/checkout@v4
- name: Test platform ${{ matrix.destination }}
run: set -o pipefail && xcodebuild -scheme Textbook -destination "${{ matrix.destination }}" test | xcbeautify
30 changes: 30 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// swift-tools-version: 5.8

import PackageDescription

let package = Package(
name: "Textbook",
platforms: [
.macOS(.v10_15),
.macCatalyst(.v13),
.iOS(.v13),
.tvOS(.v13),
],
products: [
.library(name: "Textbook", targets: ["Textbook"]),
],
targets: [
.target(name: "Textbook"),
.testTarget(name: "TextbookTests", dependencies: ["Textbook"]),
]
)

let swiftSettings: [SwiftSetting] = [
.enableExperimentalFeature("StrictConcurrency"),
]

for target in package.targets {
var settings = target.swiftSettings ?? []
settings.append(contentsOf: swiftSettings)
target.swiftSettings = settings
}
12 changes: 12 additions & 0 deletions Sources/Textbook/Platform.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import SwiftUI

#if os(macOS) && !targetEnvironment(macCatalyst)
import AppKit

typealias NSUITextView = NSTextView

#elseif os(iOS) || os(tvOS) || os(visionOS)
import UIKit

typealias NSUITextView = UITextView
#endif
2 changes: 2 additions & 0 deletions Sources/Textbook/Textbook.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The Swift Programming Language
// https://docs.swift.org/swift-book
12 changes: 12 additions & 0 deletions Tests/TextbookTests/TextbookTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import XCTest
@testable import Textbook

final class TextbookTests: 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
}
}

0 comments on commit bd2220a

Please sign in to comment.