Skip to content

Commit

Permalink
Use modulemap instead of bridging header
Browse files Browse the repository at this point in the history
Conflicts:
	Project/NSData+GZIP.xcodeproj/project.pbxproj
  • Loading branch information
1024jp committed Aug 31, 2015
1 parent 06e63c1 commit a6e5d8c
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Change Log

- Migrate code to Swift 2.0
- Change to throw error instead returning `nil`.
- Use Modulemap for zlib instead of `Bridging-Header.h` (see README for how to install).



Expand Down
Binary file added Documentation/binary_link@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/search_paths@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions Project/NSData+GZIP.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
2A58A75B1B00F414005FBBC2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2A58A75C1B00F414005FBBC2 /* NSData_GZIPTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSData_GZIPTests.swift; sourceTree = "<group>"; };
2A58A7611B00F42C005FBBC2 /* NSData+GZIP.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSData+GZIP.swift"; sourceTree = "<group>"; };
2A58A7681B00F70A005FBBC2 /* NSData+GZIPTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+GZIPTests-Bridging-Header.h"; sourceTree = "<group>"; };
2A58A77D1B00FBEF005FBBC2 /* Tests iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
2A58A7801B00FBF0005FBBC2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2AD497381B8E2A2D00AFBA1B /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
2AD4973A1B8E2A3800AFBA1B /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; };
2AF7F0BE1B6E1CD100EBA69A /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = SOURCE_ROOT; };
2AFCA7931B661CB5006DF1F4 /* zlib */ = {isa = PBXFileReference; lastKnownFileType = folder; name = zlib; path = ../zlib; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -53,6 +53,7 @@
children = (
2AF7F0BE1B6E1CD100EBA69A /* CHANGELOG.md */,
2A58A7631B00F437005FBBC2 /* NSData+GZIP */,
2AFCA7941B661CBA006DF1F4 /* Modules */,
2A58A7881B00FD11005FBBC2 /* Tests */,
2A58A7581B00F414005FBBC2 /* Products */,
);
Expand Down Expand Up @@ -123,7 +124,6 @@
isa = PBXGroup;
children = (
2A58A75C1B00F414005FBBC2 /* NSData_GZIPTests.swift */,
2A58A7681B00F70A005FBBC2 /* NSData+GZIPTests-Bridging-Header.h */,
2A58A7591B00F414005FBBC2 /* OS X */,
2A58A77E1B00FBEF005FBBC2 /* iOS */,
);
Expand All @@ -138,6 +138,14 @@
name = Libraries;
sourceTree = "<group>";
};
2AFCA7941B661CBA006DF1F4 /* Modules */ = {
isa = PBXGroup;
children = (
2AFCA7931B661CB5006DF1F4 /* zlib */,
);
name = Modules;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -257,7 +265,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/NSData+GZIPTests-Bridging-Header.h";
SWIFT_INCLUDE_PATHS = ../zlib;
};
name = Debug;
};
Expand All @@ -266,7 +274,7 @@
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MACOSX_DEPLOYMENT_TARGET = 10.9;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/NSData+GZIPTests-Bridging-Header.h";
SWIFT_INCLUDE_PATHS = ../zlib;
};
name = Release;
};
Expand Down
5 changes: 0 additions & 5 deletions Project/Tests/NSData+GZIPTests-Bridging-Header.h

This file was deleted.

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ let decompressedData : NSData = try! compressedData.gunzippedData()
## Installation

1. Add `NSData+GZIP.swift` file to your project.
2. Add `libz.tbd` library to your project.
3. Add a line `#include <zlib.h>` to your ProjectName-Bridging-Header.h file.
2. Add `zlib/` directory to your project.
3. In *Build Phases*, add `libz.tbd` library to your project.
![screenshot](Documentation/binary_link@2x.png)
4. In *Build Settings* > *Swift Compiler - Search Paths*, Add path to `zlib/` to Import Paths (`SWIFT_INCLUDE_PATHS`).
![screenshot](Documentation/search_paths@2x.png)
4. Invoke from your Swift/ObjC files.


Expand Down
1 change: 1 addition & 0 deletions Sources/NSData+GZIP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/

import Foundation
import zlib

private let CHUNK_SIZE: Int = 2 ^ 14
private let STREAM_SIZE: Int32 = Int32(sizeof(z_stream))
Expand Down
1 change: 1 addition & 0 deletions zlib/include.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <zlib.h>
4 changes: 4 additions & 0 deletions zlib/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module zlib [system] {
header "include.h"
export *
}

0 comments on commit a6e5d8c

Please sign in to comment.