diff --git a/.gitignore b/.gitignore index 0df2c64..1d05ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# macOS & Xcode +# Finder and Xcode .DS_Store xcuserdata/ @@ -15,6 +15,3 @@ xcuserdata/ # by the `swift package config` command to store its config (currently, the only # config I’m aware of are the mirrors for downloading packages). /.swiftpm/ - -# Carthage -/Carthage/ diff --git a/HPNSwizzling.xcodeproj/project.pbxproj b/HPNSwizzling.xcodeproj/project.pbxproj index b47fb5e..9e9ff1a 100644 --- a/HPNSwizzling.xcodeproj/project.pbxproj +++ b/HPNSwizzling.xcodeproj/project.pbxproj @@ -7,16 +7,12 @@ objects = { /* Begin PBXBuildFile section */ - 7B02C7AD22355CDE000481E8 /* ObjcCategoryLibrary.c in Sources */ = {isa = PBXBuildFile; fileRef = 7B3176152015282100AD66FD /* ObjcCategoryLibrary.c */; }; - 7B02C7B322355CDE000481E8 /* HPNSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B317610201527E900AD66FD /* HPNSwizzling.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7B317611201527E900AD66FD /* HPNSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B317610201527E900AD66FD /* HPNSwizzling.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7B3176162015282100AD66FD /* ObjcCategoryLibrary.c in Sources */ = {isa = PBXBuildFile; fileRef = 7B3176152015282100AD66FD /* ObjcCategoryLibrary.c */; }; 7B8BD02320026E8C009BE667 /* HPNSwizzling.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B8BD01A20026E8C009BE667 /* HPNSwizzling.framework */; }; 7B8E47D524840E9700FA751E /* HPNSwizzlingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B8BD034200274B9009BE667 /* HPNSwizzlingTests.swift */; }; 7BC0AFB52235679400EF4920 /* NSObject+HPNSwizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC0AFB12235679400EF4920 /* NSObject+HPNSwizzling.m */; }; - 7BC0AFB62235679400EF4920 /* NSObject+HPNSwizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC0AFB12235679400EF4920 /* NSObject+HPNSwizzling.m */; }; 7BC0AFB72235679400EF4920 /* NSObject+HPNSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC0AFB22235679400EF4920 /* NSObject+HPNSwizzling.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7BC0AFB82235679400EF4920 /* NSObject+HPNSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC0AFB22235679400EF4920 /* NSObject+HPNSwizzling.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7BC0AFC022356A5000EF4920 /* HPNSimpleObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC0AFBF22356A5000EF4920 /* HPNSimpleObject.m */; }; 7BC0AFC322356C9000EF4920 /* HPNSimpleObject+Swizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC0AFC222356C9000EF4920 /* HPNSimpleObject+Swizzling.m */; }; /* End PBXBuildFile section */ @@ -32,7 +28,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 7B02C7B922355CDE000481E8 /* HPNSwizzling.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HPNSwizzling.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7B21BACE2003B2C600DFF758 /* Readme.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Readme.md; sourceTree = ""; wrapsLines = 1; }; 7B21BAD12003BF0600DFF758 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; 7B317610201527E900AD66FD /* HPNSwizzling.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HPNSwizzling.h; sourceTree = ""; }; @@ -55,13 +50,6 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 7B02C7AF22355CDE000481E8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 7B8BD01620026E8C009BE667 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -101,7 +89,6 @@ children = ( 7B8BD01A20026E8C009BE667 /* HPNSwizzling.framework */, 7B8BD02220026E8C009BE667 /* HPNSwizzlingTests.xctest */, - 7B02C7B922355CDE000481E8 /* HPNSwizzling.framework */, ); name = Products; sourceTree = ""; @@ -168,15 +155,6 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 7B02C7B022355CDE000481E8 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 7BC0AFB82235679400EF4920 /* NSObject+HPNSwizzling.h in Headers */, - 7B02C7B322355CDE000481E8 /* HPNSwizzling.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 7B8BD01720026E8C009BE667 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -189,24 +167,6 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 7B02C7AA22355CDE000481E8 /* HPNSwizzling-Static */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7B02C7B622355CDE000481E8 /* Build configuration list for PBXNativeTarget "HPNSwizzling-Static" */; - buildPhases = ( - 7B02C7AB22355CDE000481E8 /* Sources */, - 7B02C7AF22355CDE000481E8 /* Frameworks */, - 7B02C7B022355CDE000481E8 /* Headers */, - 7B02C7B522355CDE000481E8 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "HPNSwizzling-Static"; - productName = "happnLogger-macOS"; - productReference = 7B02C7B922355CDE000481E8 /* HPNSwizzling.framework */; - productType = "com.apple.product-type.framework"; - }; 7B8BD01920026E8C009BE667 /* HPNSwizzling */ = { isa = PBXNativeTarget; buildConfigurationList = 7B8BD02B20026E8C009BE667 /* Build configuration list for PBXNativeTarget "HPNSwizzling" */; @@ -253,10 +213,6 @@ LastUpgradeCheck = 0930; ORGANIZATIONNAME = happn; TargetAttributes = { - 7B02C7AA22355CDE000481E8 = { - LastSwiftMigration = 1010; - ProvisioningStyle = Automatic; - }; 7B8BD01920026E8C009BE667 = { CreatedOnToolsVersion = 9.2; LastSwiftMigration = 1010; @@ -283,20 +239,12 @@ projectRoot = ""; targets = ( 7B8BD01920026E8C009BE667 /* HPNSwizzling */, - 7B02C7AA22355CDE000481E8 /* HPNSwizzling-Static */, 7B8BD02120026E8C009BE667 /* HPNSwizzlingTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 7B02C7B522355CDE000481E8 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 7B8BD01820026E8C009BE667 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -314,15 +262,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 7B02C7AB22355CDE000481E8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 7BC0AFB62235679400EF4920 /* NSObject+HPNSwizzling.m in Sources */, - 7B02C7AD22355CDE000481E8 /* ObjcCategoryLibrary.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 7B8BD01520026E8C009BE667 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -353,30 +292,6 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 7B02C7B722355CDE000481E8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = "Xcode Supporting Files/Framework-Info.plist"; - MACH_O_TYPE = staticlib; - PRODUCT_BUNDLE_IDENTIFIER = "com.happn.HPNSwizzling-Static"; - PRODUCT_NAME = HPNSwizzling; - }; - name = Debug; - }; - 7B02C7B822355CDE000481E8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = "Xcode Supporting Files/Framework-Info.plist"; - MACH_O_TYPE = staticlib; - PRODUCT_BUNDLE_IDENTIFIER = "com.happn.HPNSwizzling-Static"; - PRODUCT_NAME = HPNSwizzling; - }; - name = Release; - }; 7B661FA220026ACC00486182 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -410,11 +325,8 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1.0; - DYLIB_CURRENT_VERSION = 1.0; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_VERSION = A; @@ -443,7 +355,6 @@ SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.0; - VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = HPN; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; @@ -482,11 +393,8 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1.0; - DYLIB_CURRENT_VERSION = 1.0; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_VERSION = A; @@ -508,7 +416,6 @@ SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = HPN; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; @@ -519,11 +426,16 @@ buildSettings = { CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DYLIB_COMPATIBILITY_VERSION = 1.0; + DYLIB_CURRENT_VERSION = 1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Xcode Supporting Files/Framework-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = "$(DYLIB_CURRENT_VERSION)"; PRODUCT_BUNDLE_IDENTIFIER = com.happn.HPNSwizzling; - PRODUCT_NAME = HPNSwizzling; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; }; @@ -532,11 +444,16 @@ buildSettings = { CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DYLIB_COMPATIBILITY_VERSION = 1.0; + DYLIB_CURRENT_VERSION = 1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Xcode Supporting Files/Framework-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = "$(DYLIB_CURRENT_VERSION)"; PRODUCT_BUNDLE_IDENTIFIER = com.happn.HPNSwizzling; - PRODUCT_NAME = HPNSwizzling; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + VERSIONING_SYSTEM = "apple-generic"; }; name = Release; }; @@ -548,7 +465,7 @@ INFOPLIST_FILE = "Xcode Supporting Files/Test-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.happn.HPNSwizzlingTests; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SWIFT_OBJC_BRIDGING_HEADER = "Xcode Supporting Files/HPNSwizzling-Tests-Bridging-Header.h"; }; name = Debug; @@ -561,7 +478,7 @@ INFOPLIST_FILE = "Xcode Supporting Files/Test-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.happn.HPNSwizzlingTests; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SWIFT_OBJC_BRIDGING_HEADER = "Xcode Supporting Files/HPNSwizzling-Tests-Bridging-Header.h"; }; name = Release; @@ -569,15 +486,6 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 7B02C7B622355CDE000481E8 /* Build configuration list for PBXNativeTarget "HPNSwizzling-Static" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7B02C7B722355CDE000481E8 /* Debug */, - 7B02C7B822355CDE000481E8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 7B661F9620026ACC00486182 /* Build configuration list for PBXProject "HPNSwizzling" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Readme.md b/Readme.md index 995f75a..cb7e248 100644 --- a/Readme.md +++ b/Readme.md @@ -1,20 +1,18 @@ # HPNSwizzling -![Platforms](https://img.shields.io/badge/platform-macOS%20|%20iOS%20|%20tvOS%20|%20watchOS-lightgrey.svg?style=flat) [![SPM compatible](https://img.shields.io/badge/SPM-compatible-E05C43.svg?style=flat)](https://swift.org/package-manager/) [![Carthage compatible](https://img.shields.io/badge/carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![License](https://img.shields.io/github/license/happn-tech/HPNSwizzling.svg)](License.txt) [![happn](https://img.shields.io/badge/from-happn-0087B4.svg?style=flat)](https://happn.com) +![Platforms](https://img.shields.io/badge/platform-macOS%20|%20iOS%20|%20tvOS%20|%20watchOS-lightgrey.svg?style=flat) [![SPM compatible](https://img.shields.io/badge/SPM-compatible-E05C43.svg?style=flat)](https://swift.org/package-manager/) [![License](https://img.shields.io/github/license/happn-tech/HPNSwizzling.svg)](License.txt) [![happn](https://img.shields.io/badge/from-happn-0087B4.svg?style=flat)](https://happn.com) A swizzling that works. ## Installation -Either via SPM (recommended), or Carthage, or by copying `NSObject+HPNSwizzling.{h,m}` into your project. +Either via SPM (recommended), or by copying `NSObject+HPNSwizzling.{h,m}` into your project. -⚠️ **Important**: If you decide to link against a so-called _static_ framework build of HPNSwizzling, -you **must** add the `-ObjC` flag in _Other Linker Flags_ (`OTHER_LDFLAGS`) in the build settings of -your project. Otherwise you’ll get a crash at runtime when Swizzling something. -The error message will be something along the lines of `+[SwizzledClass hpn_swizzle:with:store:]: -unrecognized selector sent to class`. +### Important Note +The repository does have an `xcodeproj` with a shared scheme for debug purposes. The project +might be compatible with Carthage–or not. It is not officially supported but might work for you. ## Usage ```objectivec -@import HPNSwizzling; /* If installed via SPM or Carthage. */ +@import HPNSwizzling; /* If installed via SPM. */ @implementation NSView (MyViewAdditions)