Skip to content

Commit

Permalink
test: Add macOS SwiftUI sample app (#4459)
Browse files Browse the repository at this point in the history
Add a sample app for macOS with SwiftUI using the
NSApplicationDelegateAdaptor.
  • Loading branch information
philipphofmann authored Oct 24, 2024
1 parent 750f4d7 commit 2d0e628
Show file tree
Hide file tree
Showing 8 changed files with 547 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,25 @@ jobs:

build-sample:
name: Sample ${{ matrix.scheme }}
runs-on: macos-13
runs-on: macos-14
strategy:
fail-fast: false
matrix:
# other sample projects are built in ui-tests
scheme:
- macOS-Swift
- iOS13-Swift
- watchOS-Swift WatchKit App
include:
- scheme: macOS-Swift
xcode: 15.4
- scheme: iOS13-Swift
xcode: 15.4
- scheme: watchOS-Swift WatchKit App
xcode: 15.4
# Only compiles on Xcode 16.0
- scheme: macOS-SwiftUI
xcode: 16.0

steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh
- run: ./scripts/ci-select-xcode.sh ${{ matrix.xcode }}

# Disable code signing. We just want to make sure these compile.
- run: >-
Expand Down
367 changes: 367 additions & 0 deletions Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,367 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 77;
objects = {

/* Begin PBXBuildFile section */
62870A9B2CC7C0650071284D /* SampleAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 62870A9A2CC7C0650071284D /* SampleAssets.xcassets */; };
62C97D2B2CC6353C00DDA204 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62C97D2A2CC6353C00DDA204 /* Sentry.framework */; };
62C97D2C2CC6353C00DDA204 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 62C97D2A2CC6353C00DDA204 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
62C97D2F2CC6354300DDA204 /* SentrySwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62C97D2E2CC6354300DDA204 /* SentrySwiftUI.framework */; };
62C97D302CC6354300DDA204 /* SentrySwiftUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 62C97D2E2CC6354300DDA204 /* SentrySwiftUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
62C97D2D2CC6353C00DDA204 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
62C97D2C2CC6353C00DDA204 /* Sentry.framework in Embed Frameworks */,
62C97D302CC6354300DDA204 /* SentrySwiftUI.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
62870A9A2CC7C0650071284D /* SampleAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = SampleAssets.xcassets; path = ../SampleAssets.xcassets; sourceTree = "<group>"; };
62C97D0F2CC634DD00DDA204 /* macOS-SwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "macOS-SwiftUI.app"; sourceTree = BUILT_PRODUCTS_DIR; };
62C97D2A2CC6353C00DDA204 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; };
62C97D2E2CC6354300DDA204 /* SentrySwiftUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SentrySwiftUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFileSystemSynchronizedRootGroup section */
62C97D112CC634DD00DDA204 /* macOS-SwiftUI */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = "macOS-SwiftUI";
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
62C97D0C2CC634DD00DDA204 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
62C97D2B2CC6353C00DDA204 /* Sentry.framework in Frameworks */,
62C97D2F2CC6354300DDA204 /* SentrySwiftUI.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
62C97D062CC634DD00DDA204 = {
isa = PBXGroup;
children = (
62870A9A2CC7C0650071284D /* SampleAssets.xcassets */,
62C97D112CC634DD00DDA204 /* macOS-SwiftUI */,
62C97D292CC6353C00DDA204 /* Frameworks */,
62C97D102CC634DD00DDA204 /* Products */,
);
sourceTree = "<group>";
};
62C97D102CC634DD00DDA204 /* Products */ = {
isa = PBXGroup;
children = (
62C97D0F2CC634DD00DDA204 /* macOS-SwiftUI.app */,
);
name = Products;
sourceTree = "<group>";
};
62C97D292CC6353C00DDA204 /* Frameworks */ = {
isa = PBXGroup;
children = (
62C97D2E2CC6354300DDA204 /* SentrySwiftUI.framework */,
62C97D2A2CC6353C00DDA204 /* Sentry.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
62C97D0E2CC634DD00DDA204 /* macOS-SwiftUI */ = {
isa = PBXNativeTarget;
buildConfigurationList = 62C97D1E2CC634DE00DDA204 /* Build configuration list for PBXNativeTarget "macOS-SwiftUI" */;
buildPhases = (
62C97D0B2CC634DD00DDA204 /* Sources */,
62C97D0C2CC634DD00DDA204 /* Frameworks */,
62C97D0D2CC634DD00DDA204 /* Resources */,
62C97D2D2CC6353C00DDA204 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
fileSystemSynchronizedGroups = (
62C97D112CC634DD00DDA204 /* macOS-SwiftUI */,
);
name = "macOS-SwiftUI";
packageProductDependencies = (
);
productName = "macOS-SwiftUI";
productReference = 62C97D0F2CC634DD00DDA204 /* macOS-SwiftUI.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
62C97D072CC634DD00DDA204 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1600;
LastUpgradeCheck = 1600;
TargetAttributes = {
62C97D0E2CC634DD00DDA204 = {
CreatedOnToolsVersion = 16.0;
};
};
};
buildConfigurationList = 62C97D0A2CC634DD00DDA204 /* Build configuration list for PBXProject "macOS-SwiftUI" */;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 62C97D062CC634DD00DDA204;
minimizedProjectReferenceProxies = 1;
preferredProjectObjectVersion = 77;
productRefGroup = 62C97D102CC634DD00DDA204 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
62C97D0E2CC634DD00DDA204 /* macOS-SwiftUI */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
62C97D0D2CC634DD00DDA204 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
62870A9B2CC7C0650071284D /* SampleAssets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
62C97D0B2CC634DD00DDA204 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
62C97D1C2CC634DE00DDA204 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
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;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
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;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
62C97D1D2CC634DE00DDA204 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
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;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
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;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
};
name = Release;
};
62C97D1F2CC634DE00DDA204 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "macOS-SwiftUI/macOS_SwiftUI.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"macOS-SwiftUI/Preview Content\"";
DEVELOPMENT_TEAM = 97JCY7859U;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.4;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sentry.macOS-SwiftUI";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
62C97D202CC634DE00DDA204 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "macOS-SwiftUI/macOS_SwiftUI.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"macOS-SwiftUI/Preview Content\"";
DEVELOPMENT_TEAM = 97JCY7859U;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.4;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sentry.macOS-SwiftUI";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
62C97D0A2CC634DD00DDA204 /* Build configuration list for PBXProject "macOS-SwiftUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
62C97D1C2CC634DE00DDA204 /* Debug */,
62C97D1D2CC634DE00DDA204 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
62C97D1E2CC634DE00DDA204 /* Build configuration list for PBXNativeTarget "macOS-SwiftUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
62C97D1F2CC634DE00DDA204 /* Debug */,
62C97D202CC634DE00DDA204 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 62C97D072CC634DD00DDA204 /* Project object */;
}
Loading

0 comments on commit 2d0e628

Please sign in to comment.