From 30f9b49596a3e05b683748df2f2d8aafb5e85877 Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Tue, 10 Nov 2015 15:46:34 +0100 Subject: [PATCH 1/3] Adds Cocoapods framework support Two main changes here: 1. Sets `header_dir` to WordPressShared to avoid problems with underscores/dashes in names. I bumped the version to 0.5 because this changes how you import headers from this pod. 2. Made WPAnimatedImageResponseSerializer non-public. Since it's header file imports from AFNetworking (because it's a subclass), it was giving errors about importing a non-modular header. I think the proper fix would have been to switch to `@import` but that would only work if frameworks are enabled. In any case, WPAnimatedImageResponseSerializer isn't used outside WPImageSource, so we can revisit this if we need to reuse that class somewhere else. --- Podfile.lock | 2 +- WordPress-iOS-Shared.podspec | 6 ++-- .../project.pbxproj | 32 ++++++++++++++++--- .../WPAnimatedImageResponseSerializer.h | 0 .../WPAnimatedImageResponseSerializer.m | 0 5 files changed, 33 insertions(+), 7 deletions(-) rename WordPress-iOS-Shared/{Core => Private}/WPAnimatedImageResponseSerializer.h (100%) rename WordPress-iOS-Shared/{Core => Private}/WPAnimatedImageResponseSerializer.m (100%) diff --git a/Podfile.lock b/Podfile.lock index 266a46b..5babc7b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -43,4 +43,4 @@ SPEC CHECKSUMS: OCMock: a10ea9f0a6e921651f96f78b6faee95ebc813b92 OHHTTPStubs: cc1b9cb45b963daf891aa736f35d29d74308f0c9 -COCOAPODS: 0.37.2 +COCOAPODS: 0.39.0 diff --git a/WordPress-iOS-Shared.podspec b/WordPress-iOS-Shared.podspec index 5d419d9..9b609d1 100644 --- a/WordPress-iOS-Shared.podspec +++ b/WordPress-iOS-Shared.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPress-iOS-Shared" - s.version = "0.4.4" + s.version = "0.5" s.summary = "Shared components used in building the WordPress iOS apps and other library components." s.description = <<-DESC @@ -15,11 +15,13 @@ Pod::Spec.new do |s| s.social_media_url = "http://twitter.com/WordPressiOS" s.platform = :ios, "7.0" s.source = { :git => "https://github.com/wordpress-mobile/WordPress-iOS-Shared.git", :tag => s.version.to_s } - s.source_files = 'WordPress-iOS-Shared/Core' + s.source_files = [ 'WordPress-iOS-Shared/Core', 'WordPress-iOS-Shared/Private' ] + s.public_header_files = 'WordPress-iOS-Shared/Core/*.h' s.ios.resource_bundle = { 'WordPress-iOS-Shared' => 'WordPress-iOS-Shared/Assets/*.{ttf,otf}' } s.exclude_files = 'WordPress-iOS-Shared/Exclude' s.prefix_header_file = "WordPress-iOS-Shared/WordPress-iOS-Shared-Prefix.pch" s.requires_arc = true + s.header_dir = 'WordPressShared' s.dependency 'AFNetworking', '~> 2.5' s.dependency 'CocoaLumberjack', '= 2.0.0' diff --git a/WordPress-iOS-Shared.xcodeproj/project.pbxproj b/WordPress-iOS-Shared.xcodeproj/project.pbxproj index 495e0cc..d9f59f1 100644 --- a/WordPress-iOS-Shared.xcodeproj/project.pbxproj +++ b/WordPress-iOS-Shared.xcodeproj/project.pbxproj @@ -68,8 +68,8 @@ 897FA2B40A6E81DB4E7F0435 /* Pods-WordPress-iOS-SharedTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPress-iOS-SharedTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WordPress-iOS-SharedTests/Pods-WordPress-iOS-SharedTests.debug.xcconfig"; sourceTree = ""; }; 9309B52B192BEECC00B69F69 /* WordPressShared.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WordPressShared.h; path = Exclude/WordPressShared.h; sourceTree = ""; }; 9309B52C192BEECC00B69F69 /* WordPressShared.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WordPressShared.m; path = Exclude/WordPressShared.m; sourceTree = ""; }; - 9309B531192F9C2000B69F69 /* WPAnimatedImageResponseSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WPAnimatedImageResponseSerializer.h; path = Core/WPAnimatedImageResponseSerializer.h; sourceTree = ""; }; - 9309B532192F9C2000B69F69 /* WPAnimatedImageResponseSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WPAnimatedImageResponseSerializer.m; path = Core/WPAnimatedImageResponseSerializer.m; sourceTree = ""; }; + 9309B531192F9C2000B69F69 /* WPAnimatedImageResponseSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPAnimatedImageResponseSerializer.h; sourceTree = ""; }; + 9309B532192F9C2000B69F69 /* WPAnimatedImageResponseSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPAnimatedImageResponseSerializer.m; sourceTree = ""; }; 931A0FEA192A9CDD00D3CC11 /* libWordPress-iOS-Shared.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libWordPress-iOS-Shared.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 931A0FED192A9CDD00D3CC11 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 931A0FF1192A9CDD00D3CC11 /* WordPress-iOS-Shared-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WordPress-iOS-Shared-Prefix.pch"; sourceTree = ""; }; @@ -168,6 +168,7 @@ 931A0FEF192A9CDD00D3CC11 /* WordPress-iOS-Shared */ = { isa = PBXGroup; children = ( + E13D93EF1BF235BA00CCBA7C /* Private */, E154809F1A43035700FA4EDD /* Core */, 931A0FF0192A9CDD00D3CC11 /* Supporting Files */, ); @@ -210,8 +211,6 @@ children = ( 744DA844194F3A76002CD6E9 /* UIImage+Util.h */, 744DA845194F3A76002CD6E9 /* UIImage+Util.m */, - 9309B531192F9C2000B69F69 /* WPAnimatedImageResponseSerializer.h */, - 9309B532192F9C2000B69F69 /* WPAnimatedImageResponseSerializer.m */, 931A101A192A9DA500D3CC11 /* WPImageSource.h */, 931A101B192A9DA500D3CC11 /* WPImageSource.m */, 931A1014192A9D5200D3CC11 /* NSString+Util.h */, @@ -265,6 +264,15 @@ name = "Test Data"; sourceTree = ""; }; + E13D93EF1BF235BA00CCBA7C /* Private */ = { + isa = PBXGroup; + children = ( + 9309B531192F9C2000B69F69 /* WPAnimatedImageResponseSerializer.h */, + 9309B532192F9C2000B69F69 /* WPAnimatedImageResponseSerializer.m */, + ); + path = Private; + sourceTree = ""; + }; E154809F1A43035700FA4EDD /* Core */ = { isa = PBXGroup; children = ( @@ -316,6 +324,7 @@ 931A0FF7192A9CDD00D3CC11 /* Frameworks */, 931A0FF8192A9CDD00D3CC11 /* Resources */, 01EFB93CB9504D3780477772 /* Copy Pods Resources */, + 0DD01DEF03ABC712BB9DEA89 /* Embed Pods Frameworks */, ); buildRules = ( ); @@ -397,6 +406,21 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; + 0DD01DEF03ABC712BB9DEA89 /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-WordPress-iOS-SharedTests/Pods-WordPress-iOS-SharedTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; D2BBEB69E91E4B0798D536DF /* Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/WordPress-iOS-Shared/Core/WPAnimatedImageResponseSerializer.h b/WordPress-iOS-Shared/Private/WPAnimatedImageResponseSerializer.h similarity index 100% rename from WordPress-iOS-Shared/Core/WPAnimatedImageResponseSerializer.h rename to WordPress-iOS-Shared/Private/WPAnimatedImageResponseSerializer.h diff --git a/WordPress-iOS-Shared/Core/WPAnimatedImageResponseSerializer.m b/WordPress-iOS-Shared/Private/WPAnimatedImageResponseSerializer.m similarity index 100% rename from WordPress-iOS-Shared/Core/WPAnimatedImageResponseSerializer.m rename to WordPress-iOS-Shared/Private/WPAnimatedImageResponseSerializer.m From b3aaf8dc066bce8a74969d7cff37790be799537d Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Tue, 10 Nov 2015 17:18:44 +0100 Subject: [PATCH 2/3] Changed version to 0.5.0 --- WordPress-iOS-Shared.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress-iOS-Shared.podspec b/WordPress-iOS-Shared.podspec index 9b609d1..86360f7 100644 --- a/WordPress-iOS-Shared.podspec +++ b/WordPress-iOS-Shared.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPress-iOS-Shared" - s.version = "0.5" + s.version = "0.5.0" s.summary = "Shared components used in building the WordPress iOS apps and other library components." s.description = <<-DESC From ee4855172dc0b46cd236828638bd563623349230 Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Wed, 11 Nov 2015 12:57:42 +0100 Subject: [PATCH 3/3] Fixed sample project --- WordPress-iOS-Shared-Example/Podfile.lock | 36 +++++++++---------- .../project.pbxproj | 16 +++++++++ .../ColorsTableViewController.m | 2 +- .../DeviceTableViewController.m | 6 ++-- .../FontsTableViewController.m | 4 +-- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/WordPress-iOS-Shared-Example/Podfile.lock b/WordPress-iOS-Shared-Example/Podfile.lock index a5a49ff..5506677 100644 --- a/WordPress-iOS-Shared-Example/Podfile.lock +++ b/WordPress-iOS-Shared-Example/Podfile.lock @@ -1,23 +1,23 @@ PODS: - - AFNetworking (2.5.4): - - AFNetworking/NSURLConnection (= 2.5.4) - - AFNetworking/NSURLSession (= 2.5.4) - - AFNetworking/Reachability (= 2.5.4) - - AFNetworking/Security (= 2.5.4) - - AFNetworking/Serialization (= 2.5.4) - - AFNetworking/UIKit (= 2.5.4) - - AFNetworking/NSURLConnection (2.5.4): + - AFNetworking (2.6.2): + - AFNetworking/NSURLConnection (= 2.6.2) + - AFNetworking/NSURLSession (= 2.6.2) + - AFNetworking/Reachability (= 2.6.2) + - AFNetworking/Security (= 2.6.2) + - AFNetworking/Serialization (= 2.6.2) + - AFNetworking/UIKit (= 2.6.2) + - AFNetworking/NSURLConnection (2.6.2): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/NSURLSession (2.5.4): + - AFNetworking/NSURLSession (2.6.2): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/Reachability (2.5.4) - - AFNetworking/Security (2.5.4) - - AFNetworking/Serialization (2.5.4) - - AFNetworking/UIKit (2.5.4): + - AFNetworking/Reachability (2.6.2) + - AFNetworking/Security (2.6.2) + - AFNetworking/Serialization (2.6.2) + - AFNetworking/UIKit (2.6.2): - AFNetworking/NSURLConnection - AFNetworking/NSURLSession - CocoaLumberjack (2.0.0): @@ -28,7 +28,7 @@ PODS: - CocoaLumberjack/Core - CocoaLumberjack/Extensions (2.0.0): - CocoaLumberjack/Default - - WordPress-iOS-Shared (0.4.3): + - WordPress-iOS-Shared (0.5.0): - AFNetworking (~> 2.5) - CocoaLumberjack (= 2.0.0) @@ -37,11 +37,11 @@ DEPENDENCIES: EXTERNAL SOURCES: WordPress-iOS-Shared: - :path: ../ + :path: "../" SPEC CHECKSUMS: - AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e + AFNetworking: 7f317038a9710cabfa43ec56396b307b45df72ab CocoaLumberjack: a6f77d987d65dc7ba86b0f84db7d0b9084f77bcb - WordPress-iOS-Shared: 20307f6ca50f833cf6bbf98f3a7ef7643d90ce8c + WordPress-iOS-Shared: 5480e7b5c9c55158ea22c89ff44fca5597852224 -COCOAPODS: 0.37.2 +COCOAPODS: 0.39.0 diff --git a/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example.xcodeproj/project.pbxproj b/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example.xcodeproj/project.pbxproj index 5edf679..cc09d2c 100644 --- a/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example.xcodeproj/project.pbxproj +++ b/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example.xcodeproj/project.pbxproj @@ -156,6 +156,7 @@ 852FBB42197755CC002C5249 /* Frameworks */, 852FBB43197755CC002C5249 /* Resources */, BB9A98FF658A4D29953551D1 /* Copy Pods Resources */, + 20790AE04201DFFC0FF9F3EB /* Embed Pods Frameworks */, ); buildRules = ( ); @@ -207,6 +208,21 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 20790AE04201DFFC0FF9F3EB /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-WordPress-iOS-Shared-Example/Pods-WordPress-iOS-Shared-Example-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 601245E04F1A43469E176EE1 /* Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/ColorsTableViewController.m b/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/ColorsTableViewController.m index c82c2a4..d8c42bd 100644 --- a/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/ColorsTableViewController.m +++ b/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/ColorsTableViewController.m @@ -1,5 +1,5 @@ #import "ColorsTableViewController.h" -#import +#import @interface ColorsTableViewController () diff --git a/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/DeviceTableViewController.m b/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/DeviceTableViewController.m index 4a825e7..7dcc34a 100644 --- a/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/DeviceTableViewController.m +++ b/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/DeviceTableViewController.m @@ -2,9 +2,9 @@ #import "DeviceTableViewCell.h" #import "DeviceTest.h" #import "FontTableViewCell.h" -#import -#import -#import +#import +#import +#import @interface DeviceTableViewController () diff --git a/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/FontsTableViewController.m b/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/FontsTableViewController.m index c3270d3..12c0614 100644 --- a/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/FontsTableViewController.m +++ b/WordPress-iOS-Shared-Example/WordPress-iOS-Shared-Example/FontsTableViewController.m @@ -1,7 +1,7 @@ #import "FontsTableViewController.h" #import "FontTableViewCell.h" -#import -#import +#import +#import static const CGFloat FontSize = 20.0;