should be it

This commit is contained in:
2025-10-24 19:21:19 -05:00
parent a4b23fc57c
commit f09560c7b1
14047 changed files with 3161551 additions and 1 deletions

View File

@@ -0,0 +1,362 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
6A1C890A29C3991E00A7DED1 /* ExplorerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A1C890929C3991E00A7DED1 /* ExplorerApp.swift */; };
6A1C890C29C3991E00A7DED1 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A1C890B29C3991E00A7DED1 /* ContentView.swift */; };
6A1C890E29C3991F00A7DED1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6A1C890D29C3991F00A7DED1 /* Assets.xcassets */; };
6A1C891A29C39BEB00A7DED1 /* DuckDB in Frameworks */ = {isa = PBXBuildFile; productRef = 6A1C891929C39BEB00A7DED1 /* DuckDB */; };
6A72088829C4B5AA00061043 /* ExoplanetStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A72088729C4B5AA00061043 /* ExoplanetStore.swift */; };
6AAC2F5E29C4A37400ADC955 /* ErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AAC2F5D29C4A37400ADC955 /* ErrorView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
6A1C890629C3991E00A7DED1 /* ExoplanetExplorer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExoplanetExplorer.app; sourceTree = BUILT_PRODUCTS_DIR; };
6A1C890929C3991E00A7DED1 /* ExplorerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExplorerApp.swift; sourceTree = "<group>"; };
6A1C890B29C3991E00A7DED1 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
6A1C890D29C3991F00A7DED1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
6A1C891729C39BA500A7DED1 /* duckdb-swift */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "duckdb-swift"; path = ../..; sourceTree = "<group>"; };
6A72088729C4B5AA00061043 /* ExoplanetStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExoplanetStore.swift; sourceTree = "<group>"; };
6AAC2F5D29C4A37400ADC955 /* ErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6A1C890329C3991E00A7DED1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6A1C891A29C39BEB00A7DED1 /* DuckDB in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6A1C88FD29C3991E00A7DED1 = {
isa = PBXGroup;
children = (
6A1C891729C39BA500A7DED1 /* duckdb-swift */,
6A1C890829C3991E00A7DED1 /* ExoplanetExplorer */,
6A1C890729C3991E00A7DED1 /* Products */,
6A1C891829C39BEB00A7DED1 /* Frameworks */,
);
sourceTree = "<group>";
};
6A1C890729C3991E00A7DED1 /* Products */ = {
isa = PBXGroup;
children = (
6A1C890629C3991E00A7DED1 /* ExoplanetExplorer.app */,
);
name = Products;
sourceTree = "<group>";
};
6A1C890829C3991E00A7DED1 /* ExoplanetExplorer */ = {
isa = PBXGroup;
children = (
6A1C890B29C3991E00A7DED1 /* ContentView.swift */,
6AAC2F5D29C4A37400ADC955 /* ErrorView.swift */,
6A72088729C4B5AA00061043 /* ExoplanetStore.swift */,
6A1C890929C3991E00A7DED1 /* ExplorerApp.swift */,
6A1C890D29C3991F00A7DED1 /* Assets.xcassets */,
);
path = ExoplanetExplorer;
sourceTree = "<group>";
};
6A1C891829C39BEB00A7DED1 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
6A1C890529C3991E00A7DED1 /* ExoplanetExplorer */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6A1C891429C3991F00A7DED1 /* Build configuration list for PBXNativeTarget "ExoplanetExplorer" */;
buildPhases = (
6A1C890229C3991E00A7DED1 /* Sources */,
6A1C890329C3991E00A7DED1 /* Frameworks */,
6A1C890429C3991E00A7DED1 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ExoplanetExplorer;
packageProductDependencies = (
6A1C891929C39BEB00A7DED1 /* DuckDB */,
);
productName = ExoPlanetExplorer;
productReference = 6A1C890629C3991E00A7DED1 /* ExoplanetExplorer.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
6A1C88FE29C3991E00A7DED1 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 1420;
TargetAttributes = {
6A1C890529C3991E00A7DED1 = {
CreatedOnToolsVersion = 14.2;
};
};
};
buildConfigurationList = 6A1C890129C3991E00A7DED1 /* Build configuration list for PBXProject "ExoplanetExplorer" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 6A1C88FD29C3991E00A7DED1;
productRefGroup = 6A1C890729C3991E00A7DED1 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
6A1C890529C3991E00A7DED1 /* ExoplanetExplorer */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
6A1C890429C3991E00A7DED1 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6A1C890E29C3991F00A7DED1 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6A1C890229C3991E00A7DED1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6A1C890C29C3991E00A7DED1 /* ContentView.swift in Sources */,
6A1C890A29C3991E00A7DED1 /* ExplorerApp.swift in Sources */,
6AAC2F5E29C4A37400ADC955 /* ErrorView.swift in Sources */,
6A72088829C4B5AA00061043 /* ExoplanetStore.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
6A1C891229C3991F00A7DED1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
};
name = Debug;
};
6A1C891329C3991F00A7DED1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_STRICT_CONCURRENCY = complete;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
6A1C891529C3991F00A7DED1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = org.duckdb.ExoPlanetExplorer;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
6A1C891629C3991F00A7DED1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = org.duckdb.ExoPlanetExplorer;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6A1C890129C3991E00A7DED1 /* Build configuration list for PBXProject "ExoplanetExplorer" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6A1C891229C3991F00A7DED1 /* Debug */,
6A1C891329C3991F00A7DED1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6A1C891429C3991F00A7DED1 /* Build configuration list for PBXNativeTarget "ExoplanetExplorer" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6A1C891529C3991F00A7DED1 /* Debug */,
6A1C891629C3991F00A7DED1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCSwiftPackageProductDependency section */
6A1C891929C39BEB00A7DED1 /* DuckDB */ = {
isa = XCSwiftPackageProductDependency;
productName = DuckDB;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 6A1C88FE29C3991E00A7DED1 /* Project object */;
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6A1C890529C3991E00A7DED1"
BuildableName = "ExoplanetExplorer.app"
BlueprintName = "ExoplanetExplorer"
ReferencedContainer = "container:ExoplanetExplorer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6A1C890529C3991E00A7DED1"
BuildableName = "ExoplanetExplorer.app"
BlueprintName = "ExoplanetExplorer"
ReferencedContainer = "container:ExoplanetExplorer.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6A1C890529C3991E00A7DED1"
BuildableName = "ExoplanetExplorer.app"
BlueprintName = "ExoplanetExplorer"
ReferencedContainer = "container:ExoplanetExplorer.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,102 @@
//
// DuckDB
// https://github.com/duckdb/duckdb-swift
//
// Copyright © 2018-2024 Stichting DuckDB Foundation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
import Charts
import SwiftUI
@preconcurrency import TabularData
struct ContentView: View {
private enum ViewState {
case fetching(Error?)
case loaded(DataFrame)
}
let exoplanetStore: ExoplanetStore
@State private var state = ViewState.fetching(nil)
var body: some View {
Group {
switch state {
case .loaded(let dataFrame):
VStack {
Text("Number of Exoplanets Discovered By Year")
.font(.title)
.fontDesign(.default)
.fontWeight(.bold)
.multilineTextAlignment(.center)
DiscoveryYearChart(dataFrame: dataFrame)
}
case .fetching(nil):
ProgressView { Text("Fetching Data") }
case .fetching(let error?):
ErrorView(title: "Query Failed", error: error)
}
}
.padding()
.task {
do {
let frame = try await exoplanetStore.groupedByDiscoveryYear()
self.state = .loaded(frame)
}
catch {
self.state = .fetching(error)
}
}
}
}
// MARK: - Chart View
struct DiscoveryYearChart: View {
private struct ChartRow {
let year: Date
let count: Int
}
let dataFrame: DataFrame
private var rows: [ChartRow] {
let yearColumn = dataFrame.columns[0].assumingType(Int.self).filled(with: 9999)
let countColumn = dataFrame.columns[1].assumingType(Int.self).filled(with: -1)
let calendar = Calendar(identifier: .gregorian)
var rows = [ChartRow]()
for (year, count) in zip(yearColumn, countColumn) {
let dateComponents = DateComponents(calendar: calendar, year: year)
let date = dateComponents.date ?? .distantPast
rows.append(ChartRow(year: date, count: count))
}
return rows
}
var body: some View {
Chart(rows, id: \.year) { row in
BarMark(
x: .value("Year", row.year, unit: .year),
y: .value("Count", row.count)
)
}
}
}

View File

@@ -0,0 +1,58 @@
//
// DuckDB
// https://github.com/duckdb/duckdb-swift
//
// Copyright © 2018-2024 Stichting DuckDB Foundation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
import SwiftUI
struct ErrorView: View {
let title: String
let error: Error
let retryAction: (() -> Void)?
init(title: String, error: Error, retryAction: (() -> Void)? = nil) {
self.title = title
self.error = error
self.retryAction = retryAction
}
var body: some View {
VStack(spacing: 8) {
Text("☠️")
.font(.largeTitle)
Text(title)
.font(.subheadline)
.foregroundColor(.gray)
.fontWeight(.bold)
Text(error.localizedDescription)
.font(.caption)
.foregroundColor(.gray)
if let retryAction {
Button("Retry") { retryAction() }
.buttonStyle(.borderedProminent)
.padding()
}
}
.multilineTextAlignment(.center)
}
}

View File

@@ -0,0 +1,91 @@
//
// DuckDB
// https://github.com/duckdb/duckdb-swift
//
// Copyright © 2018-2024 Stichting DuckDB Foundation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
import DuckDB
import Foundation
import TabularData
final class ExoplanetStore {
static func create() async throws -> ExoplanetStore {
let (csvFileURL, _) = try await URLSession.shared.download(from: Self.csvRemoteURL)
let database = try Database(store: .inMemory)
let connection = try database.connect()
let _ = try connection.query(
"CREATE TABLE exoplanets AS SELECT * FROM read_csv_auto('\(csvFileURL.path)');")
return ExoplanetStore(database: database, connection: connection)
}
let database: Database
let connection: Connection
private init(database: Database, connection: Connection) {
self.database = database
self.connection = connection
}
func groupedByDiscoveryYear() async throws -> DataFrame {
let result = try connection.query("""
SELECT disc_year, COUNT(disc_year) AS Count
FROM exoplanets
GROUP BY disc_year
ORDER BY disc_year
""")
let discoveryYearColumn = result[0].cast(to: Int.self)
let countColumn = result[1].cast(to: Int.self)
return DataFrame(columns: [
TabularData.Column(discoveryYearColumn)
.eraseToAnyColumn(),
TabularData.Column(countColumn)
.eraseToAnyColumn(),
])
}
}
private extension ExoplanetStore {
static let csvRemoteURL: URL = {
let apiEndpointURL = URL(
string: "https://exoplanetarchive.ipac.caltech.edu/TAP/sync")!
// column descriptions available at:
// https://exoplanetarchive.ipac.caltech.edu/docs/API_PS_columns.html
let remoteQueryColumns = [
"pl_name",
"hostname",
"sy_snum",
"disc_year",
"disc_facility",
"st_mass",
"st_rad",
"st_age",
]
let remoteQuery = """
SELECT+\(remoteQueryColumns.joined(separator: "+,+"))+FROM+pscomppars
"""
return apiEndpointURL.appending(queryItems: [
.init(name: "query", value: remoteQuery),
.init(name: "format", value: "csv"),
])
}()
}

View File

@@ -0,0 +1,67 @@
//
// DuckDB
// https://github.com/duckdb/duckdb-swift
//
// Copyright © 2018-2024 Stichting DuckDB Foundation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
import SwiftUI
@main
struct ExplorerApp: App {
private enum ViewState {
case loading(Error?)
case ready(ExoplanetStore)
}
@State private var state = ViewState.loading(nil)
var body: some Scene {
WindowGroup {
Group {
switch state {
case .ready(let exoplanetStore):
ContentView(exoplanetStore: exoplanetStore)
case .loading(nil):
ProgressView { Text("Loading Exoplanets") }
case .loading(let error?):
ErrorView(title: "Failed To Load Exoplanets", error: error) {
Task { await prepareExoplanetsStore() }
}
}
}
.task {
await prepareExoplanetsStore()
}
}
}
private func prepareExoplanetsStore() async {
guard case .loading(_) = state else { return }
self.state = .loading(nil)
do {
self.state = .ready(try await ExoplanetStore.create())
}
catch {
self.state = .loading(error)
}
}
}