How to update Zlib library on Xcode?

2.7k Views Asked by At

I am trying to update Zlib on Xcode 7.1

According to zlib.h on /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/include, My Zlib version is 1.2.5.

I am trying to update it to 1.2.8

Is there a way to update xcode lib ?

I try to add libz.1.2.8.dylib to Link Binary With Libraries however my app still using zlib 1.2.5

Thanks in advance

1

There are 1 best solutions below

0
Adrian On

I managed to do this by:

  1. Rename libz.1.2.8.dylib to libz.dylib and add it to Link Binary With Libraries

  2. Add zlib.h using module.modulemap. Example

    module zlib [system] { header "zlib/zlib.h" export * }

  3. Select the target -> Build Settings -> Swift Compiler Search Path -> Add folder where you store module map on Search Path

  4. use import zlib to use zlib

Referenced from https://github.com/1024jp/NSData-GZIP