diff --git a/spm_testProject/spm_test.xcodeproj/project.pbxproj b/spm_testProject/spm_test.xcodeproj/project.pbxproj new file mode 100644 index 0000000..bfe9f06 --- /dev/null +++ b/spm_testProject/spm_test.xcodeproj/project.pbxproj @@ -0,0 +1,376 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 7ED306AD2AF8455D00F6FFE3 /* SomeObjcClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED306AC2AF8455D00F6FFE3 /* SomeObjcClass.m */; }; + 7ED5176E2AF68AB700D29ED7 /* spm_testApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED5176D2AF68AB700D29ED7 /* spm_testApp.swift */; }; + 7ED517702AF68AB700D29ED7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED5176F2AF68AB700D29ED7 /* ContentView.swift */; }; + 7ED5177E2AF68AFD00D29ED7 /* JDStatusBarNotification in Frameworks */ = {isa = PBXBuildFile; productRef = 7ED5177D2AF68AFD00D29ED7 /* JDStatusBarNotification */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 7ED306AB2AF8455D00F6FFE3 /* SomeObjcClass.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SomeObjcClass.h; sourceTree = ""; }; + 7ED306AC2AF8455D00F6FFE3 /* SomeObjcClass.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SomeObjcClass.m; sourceTree = ""; }; + 7ED5176A2AF68AB700D29ED7 /* spm_test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = spm_test.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7ED5176D2AF68AB700D29ED7 /* spm_testApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = spm_testApp.swift; sourceTree = ""; }; + 7ED5176F2AF68AB700D29ED7 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 7ED517672AF68AB700D29ED7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7ED5177E2AF68AFD00D29ED7 /* JDStatusBarNotification in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 7ED517612AF68AB700D29ED7 = { + isa = PBXGroup; + children = ( + 7ED5176C2AF68AB700D29ED7 /* spm_test */, + 7ED5176B2AF68AB700D29ED7 /* Products */, + 7ED5177C2AF68AFD00D29ED7 /* Frameworks */, + ); + sourceTree = ""; + }; + 7ED5176B2AF68AB700D29ED7 /* Products */ = { + isa = PBXGroup; + children = ( + 7ED5176A2AF68AB700D29ED7 /* spm_test.app */, + ); + name = Products; + sourceTree = ""; + }; + 7ED5176C2AF68AB700D29ED7 /* spm_test */ = { + isa = PBXGroup; + children = ( + 7ED5176D2AF68AB700D29ED7 /* spm_testApp.swift */, + 7ED5176F2AF68AB700D29ED7 /* ContentView.swift */, + 7ED306AB2AF8455D00F6FFE3 /* SomeObjcClass.h */, + 7ED306AC2AF8455D00F6FFE3 /* SomeObjcClass.m */, + ); + path = spm_test; + sourceTree = ""; + }; + 7ED5177C2AF68AFD00D29ED7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7ED517692AF68AB700D29ED7 /* spm_test */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7ED517782AF68AB900D29ED7 /* Build configuration list for PBXNativeTarget "spm_test" */; + buildPhases = ( + 7ED517662AF68AB700D29ED7 /* Sources */, + 7ED517672AF68AB700D29ED7 /* Frameworks */, + 7ED517682AF68AB700D29ED7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = spm_test; + packageProductDependencies = ( + 7ED5177D2AF68AFD00D29ED7 /* JDStatusBarNotification */, + ); + productName = spm_test; + productReference = 7ED5176A2AF68AB700D29ED7 /* spm_test.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7ED517622AF68AB700D29ED7 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1510; + LastUpgradeCheck = 1510; + TargetAttributes = { + 7ED517692AF68AB700D29ED7 = { + CreatedOnToolsVersion = 15.1; + LastSwiftMigration = 1510; + }; + }; + }; + buildConfigurationList = 7ED517652AF68AB700D29ED7 /* Build configuration list for PBXProject "spm_test" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7ED517612AF68AB700D29ED7; + packageReferences = ( + 7ED5177B2AF68ACD00D29ED7 /* XCRemoteSwiftPackageReference "JDStatusBarNotification" */, + ); + productRefGroup = 7ED5176B2AF68AB700D29ED7 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7ED517692AF68AB700D29ED7 /* spm_test */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7ED517682AF68AB700D29ED7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7ED517662AF68AB700D29ED7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7ED306AD2AF8455D00F6FFE3 /* SomeObjcClass.m in Sources */, + 7ED517702AF68AB700D29ED7 /* ContentView.swift in Sources */, + 7ED5176E2AF68AB700D29ED7 /* spm_testApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 7ED517762AF68AB900D29ED7 /* 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; + IPHONEOS_DEPLOYMENT_TARGET = 17.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7ED517772AF68AB900D29ED7 /* 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; + IPHONEOS_DEPLOYMENT_TARGET = 17.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7ED517792AF68AB900D29ED7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 8M37KCPR2Q; + 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 = "com.calimarkus.swift-test"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7ED5177A2AF68AB900D29ED7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 8M37KCPR2Q; + 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 = "com.calimarkus.swift-test"; + 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 */ + 7ED517652AF68AB700D29ED7 /* Build configuration list for PBXProject "spm_test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7ED517762AF68AB900D29ED7 /* Debug */, + 7ED517772AF68AB900D29ED7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7ED517782AF68AB900D29ED7 /* Build configuration list for PBXNativeTarget "spm_test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7ED517792AF68AB900D29ED7 /* Debug */, + 7ED5177A2AF68AB900D29ED7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 7ED5177B2AF68ACD00D29ED7 /* XCRemoteSwiftPackageReference "JDStatusBarNotification" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/calimarkus/JDStatusBarNotification.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.0.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 7ED5177D2AF68AFD00D29ED7 /* JDStatusBarNotification */ = { + isa = XCSwiftPackageProductDependency; + package = 7ED5177B2AF68ACD00D29ED7 /* XCRemoteSwiftPackageReference "JDStatusBarNotification" */; + productName = JDStatusBarNotification; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 7ED517622AF68AB700D29ED7 /* Project object */; +} diff --git a/spm_testProject/spm_test/ContentView.swift b/spm_testProject/spm_test/ContentView.swift new file mode 100644 index 0000000..c0c69f9 --- /dev/null +++ b/spm_testProject/spm_test/ContentView.swift @@ -0,0 +1,73 @@ +// +// + +import JDStatusBarNotification +import SwiftUI + +extension NotificationPresenter { + func includedStyle(_ style: IncludedStatusBarNotificationStyle) -> String { + return addStyle(named: UUID().uuidString, usingStyle: style) { $0 } + } +} + +struct ContentView: View { + + @State var isPresented: Bool = false + + var body: some View { + let presenter = NotificationPresenter.shared + + List { + Section("Classic Presentation") { + Button("The rabbit (1.5s)") { + presenter.present("Follow the white rabbit!", includedStyle: .matrix, duration: 1.5) + } + } + + Section("Swift style Presentation") { + Button("Classic-Swift (1.5s)") { + presenter.presentSwiftView(styleName: presenter.includedStyle(.dark)) { + HelloSPMView(title: "Now also working in SPM.") + } + presenter.dismiss(after: 1.5) + } + + Button("State-based (toggle)") { + isPresented.toggle() + } + .notification(isPresented: $isPresented, style: { + let s = $0.backgroundStyle + s.backgroundColor = .black + s.pillStyle.minimumWidth = 150 + s.pillStyle.height = 44 + }) { + Text("👋 Hi there!") + .font(.subheadline) + .foregroundStyle(.white) + } + } + } + } +} + +struct HelloSPMView: View { + + @State var title: String + + var body: some View { + HStack(spacing: 0) { + Image(systemName: "hands.sparkles.fill") + .foregroundStyle(.teal) + .padding(.trailing, 10) + + Text(title) + .font(.caption) + .foregroundStyle(.white) + } + .padding(.horizontal, 20) + } +} + +#Preview { + ContentView() +} diff --git a/spm_testProject/spm_test/SomeObjcClass.h b/spm_testProject/spm_test/SomeObjcClass.h new file mode 100644 index 0000000..397fa77 --- /dev/null +++ b/spm_testProject/spm_test/SomeObjcClass.h @@ -0,0 +1,8 @@ +// +// + +#import + +@interface SomeObjcClass: NSObject + +@end diff --git a/spm_testProject/spm_test/SomeObjcClass.m b/spm_testProject/spm_test/SomeObjcClass.m new file mode 100644 index 0000000..56123ee --- /dev/null +++ b/spm_testProject/spm_test/SomeObjcClass.m @@ -0,0 +1,14 @@ +// +// + +#import "SomeObjcClass.h" + +@import JDStatusBarNotification; + +@implementation SomeObjcClass + +- (void)someMethodToVerifyObjcImportAndPresentCallDoesCompile { + [[JDStatusBarNotificationPresenter sharedPresenter] presentWithText:@"text"]; +} + +@end diff --git a/spm_testProject/spm_test/spm_testApp.swift b/spm_testProject/spm_test/spm_testApp.swift new file mode 100644 index 0000000..bd786d4 --- /dev/null +++ b/spm_testProject/spm_test/spm_testApp.swift @@ -0,0 +1,16 @@ +// +// + +import SwiftUI + +@main +struct spm_testApp: App { + var body: some Scene { + WindowGroup { + NavigationView { + ContentView() + .navigationTitle("SPM Test App") + } + } + } +}