Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
WangGuibin committed Nov 4, 2022
1 parent dce8b49 commit be94819
Show file tree
Hide file tree
Showing 15 changed files with 184 additions and 132 deletions.
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- lz-string-objc (0.1.0)
- lz-string-objc (1.0.0)

DEPENDENCIES:
- lz-string-objc (from `../`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
lz-string-objc: 78f22c7e466ffa7f92873d486d3d54696a28ca3d
lz-string-objc: a514dee27f328ae276f12529c8347fe6f6c99948

PODFILE CHECKSUM: 59df45e6eae50654720630ac2d77267090c1f8d4

Expand Down
11 changes: 6 additions & 5 deletions Example/Pods/Local Podspecs/lz-string-objc.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

229 changes: 115 additions & 114 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/Tests/Tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// lz-string-objcTests.m
// lz-string-objcTests
//
// Created by [email protected] on 11/04/2022.
// Created by CoderWGB on 11/04/2022.
// Copyright (c) 2022 [email protected]. All rights reserved.
//

Expand Down
2 changes: 1 addition & 1 deletion Example/lz-string-objc/WGBAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// WGBAppDelegate.h
// lz-string-objc
//
// Created by [email protected] on 11/04/2022.
// Created by CoderWGB on 11/04/2022.
// Copyright (c) 2022 [email protected]. All rights reserved.
//

Expand Down
2 changes: 1 addition & 1 deletion Example/lz-string-objc/WGBAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// WGBAppDelegate.m
// lz-string-objc
//
// Created by [email protected] on 11/04/2022.
// Created by CoderWGB on 11/04/2022.
// Copyright (c) 2022 [email protected]. All rights reserved.
//

Expand Down
2 changes: 1 addition & 1 deletion Example/lz-string-objc/WGBViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// WGBViewController.h
// lz-string-objc
//
// Created by [email protected] on 11/04/2022.
// Created by CoderWGB on 11/04/2022.
// Copyright (c) 2022 [email protected]. All rights reserved.
//

Expand Down
23 changes: 22 additions & 1 deletion Example/lz-string-objc/WGBViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// WGBViewController.m
// lz-string-objc
//
// Created by [email protected] on 11/04/2022.
// Created by CoderWGB on 11/04/2022.
// Copyright (c) 2022 [email protected]. All rights reserved.
//

#import "WGBViewController.h"
#import <LZStringObjc.h>

@interface WGBViewController ()

Expand All @@ -18,6 +19,26 @@ - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

LZStringObjc *LZ = [LZStringObjc sharedInstance];
//base64
NSLog(@"%@",[LZ compressToBase64:@"hello"]);
NSLog(@"%@",[LZ decompressFromBase64:@"BYUwNmD2Q==="]);

//utf16
NSLog(@"%@",[LZ compressToUTF16:@"hello"]);
NSLog(@"%@",[LZ decompressFromUTF16:@"ˢ䰭䰾搠"]);

//unit8
NSLog(@"%@",[LZ compressToUint8Array:@"hello"]);
NSString *str = @"55,129,176,166,7,96,230,2,224,22,0,32,47,2,10,192,26,4,8,192,158,51,0,206,200,32,3,0,30,1,176,1,193,106,20,12,96,197,1,152,11,228,0,0";
NSArray *strArr = [str componentsSeparatedByString:@","];
NSLog(@"%@",[LZ decompressFromUint8Array:strArr]);

//uri
NSLog(@"%@",[LZ compressToEncodedURIComponent:@"hello"]);
NSLog(@"%@",[LZ decompressFromEncodedURIComponent:@"BYUwNmD2Q"]);

}

- (void)didReceiveMemoryWarning
Expand Down
2 changes: 1 addition & 1 deletion Example/lz-string-objc/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// main.m
// lz-string-objc
//
// Created by [email protected] on 11/04/2022.
// Created by CoderWGB on 11/04/2022.
// Copyright (c) 2022 [email protected]. All rights reserved.
//

Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,38 @@
[![License](https://img.shields.io/cocoapods/l/lz-string-objc.svg?style=flat)](https://cocoapods.org/pods/lz-string-objc)
[![Platform](https://img.shields.io/cocoapods/p/lz-string-objc.svg?style=flat)](https://cocoapods.org/pods/lz-string-objc)

## Introduce

站在巨人的肩膀上造轮子
https://github.com/pieroxy/lz-string 一个js压缩库
本轮子只是为了`OC`方便调用的问题,通过`js`去调用`lz-string.js`的接口

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.
```objc
#import <LZStringObjc.h>

LZStringObjc *LZ = [LZStringObjc sharedInstance];
//base64
NSLog(@"%@",[LZ compressToBase64:@"hello"]);
NSLog(@"%@",[LZ decompressFromBase64:@"BYUwNmD2Q==="]);

//utf16
NSLog(@"%@",[LZ compressToUTF16:@"hello"]);
NSLog(@"%@",[LZ decompressFromUTF16:@"ˢ䰭䰾搠"]);

//unit8
NSLog(@"%@",[LZ compressToUint8Array:@"hello"]);
NSString *str = @"55,129,176,166,7,96,230,2,224,22,0,32,47,2,10,192,26,4,8,192,158,51,0,206,200,32,3,0,30,1,176,1,193,106,20,12,96,197,1,152,11,228,0,0";
NSArray *strArr = [str componentsSeparatedByString:@","];
NSLog(@"%@",[LZ decompressFromUint8Array:strArr]);

//uri
NSLog(@"%@",[LZ compressToEncodedURIComponent:@"hello"]);
NSLog(@"%@",[LZ decompressFromEncodedURIComponent:@"BYUwNmD2Q"]);

```
## Requirements
## Installation
Expand All @@ -22,7 +50,7 @@ pod 'lz-string-objc'

## Author

[email protected], [email protected]
CoderWGB, [email protected]

## License

Expand Down
2 changes: 1 addition & 1 deletion LZStringObjc.h → lz-string-objc/Classes/LZStringObjc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN

// 站在巨人的肩膀上造轮子
// https://github.com/pieroxy/lz-string 一个js压缩库
// 本轮子解决OC简单的调用问题 无需自己动手去写算法 直接通过js去调用lz-string.js的接口(拿来把你)
// 本轮子解决OC简单的调用问题 无需自己动手去写算法 直接通过js去调用lz-string.js的接口

@interface LZStringObjc : NSObject

Expand Down
File renamed without changes.

0 comments on commit be94819

Please sign in to comment.