{"id":21031841,"url":"https://github.com/zekunyan/ttgpuzzleverify","last_synced_at":"2025-04-07T19:17:01.867Z","repository":{"id":56923318,"uuid":"76188025","full_name":"zekunyan/TTGPuzzleVerify","owner":"zekunyan","description":"By completing image puzzle game, TTGPuzzleVerify is a more user-friendly verification tool on iOS, which is highly customizable and easy to use. 体验更友好的拼图验证控件","archived":false,"fork":false,"pushed_at":"2016-12-11T18:35:53.000Z","size":4403,"stargazers_count":361,"open_issues_count":0,"forks_count":62,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T16:22:01.614Z","etag":null,"topics":["animation","custom-puzzle-shape","ios","objective-c","puzzle","ui","verification"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zekunyan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-11T17:09:30.000Z","updated_at":"2024-11-01T01:51:47.000Z","dependencies_parsed_at":"2022-08-21T05:20:26.810Z","dependency_job_id":null,"html_url":"https://github.com/zekunyan/TTGPuzzleVerify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zekunyan%2FTTGPuzzleVerify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zekunyan%2FTTGPuzzleVerify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zekunyan%2FTTGPuzzleVerify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zekunyan%2FTTGPuzzleVerify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zekunyan","download_url":"https://codeload.github.com/zekunyan/TTGPuzzleVerify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713258,"owners_count":20983683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","custom-puzzle-shape","ios","objective-c","puzzle","ui","verification"],"created_at":"2024-11-19T12:32:54.948Z","updated_at":"2025-04-07T19:17:01.833Z","avatar_url":"https://github.com/zekunyan.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TTGPuzzleVerify\n\n[![CI Status](http://img.shields.io/travis/zekunyan/TTGPuzzleVerify.svg?style=flat)](https://travis-ci.org/zekunyan/TTGPuzzleVerify)\n[![Version](https://img.shields.io/cocoapods/v/TTGPuzzleVerify.svg?style=flat)](http://cocoapods.org/pods/TTGPuzzleVerify)\n[![License](https://img.shields.io/cocoapods/l/TTGPuzzleVerify.svg?style=flat)](http://cocoapods.org/pods/TTGPuzzleVerify)\n[![Platform](https://img.shields.io/cocoapods/p/TTGPuzzleVerify.svg?style=flat)](http://cocoapods.org/pods/TTGPuzzleVerify)\n\n![Screenshot](https://github.com/zekunyan/TTGPuzzleVerify/raw/master/Resources/TTGPuzzleVerify.jpeg)\n\n![Gif](https://github.com/zekunyan/TTGPuzzleVerify/raw/master/Resources/TTGPuzzleVerify.gif)\n\n## What \nBy completing **image puzzle game**, TTGPuzzleVerify is a **more user-friendly** verification tool on iOS, which is highly customizable and easy to use. It supports square, circle, classic or custom puzzle shape. User can complete the verification by sliding horizontally, vertically or directly dragging the puzzle block.\n\n## Features\n* More user-friendly\n* Highly Customizable\n* Classic, square, circle or custom puzzle shape\n* Slide horizontally or vertically or drag the puzzle directly\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\niOS 7 and later.\n\n## Installation\n\nTTGPuzzleVerify is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"TTGPuzzleVerify\"\n```\n\n## Usage\n`TTGPuzzleVerifyView`\n\n### Basic use\n```\n// Import\n#import \u003cTTGPuzzleVerify/TTGPuzzleVerifyView.h\u003e\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    \n    // Create TTGPuzzleVerifyView instance\n    _puzzleVerifyView = [[TTGPuzzleVerifyView alloc] initWithFrame:CGRectMake(20, 20, 320, 200)];\n    [self.view addSubview:_puzzleVerifyView];\n    \n    // Set image\n    _puzzleVerifyView.image = [UIImage imageNamed:@\"pic\"];\n    \n    // Set the puzzle blank position\n    _puzzleVerifyView.puzzleBlankPosition = CGPointMake(200, 40);\n    \n    // Set init puzzle position\n    _puzzleVerifyView.puzzlePosition = CGPointMake(10, 40);\n    \n    // Callback\n    [_puzzleVerifyView setVerificationChangeBlock:^(TTGPuzzleVerifyView *view, BOOL isVerified) {\n        if (isVerified) {\n            // User complete the verification\n        }\n    }];\n}\n\n// On slide changed\n- (IBAction)onSliderChange:(UISlider *)sender {\n    // Update position\n    _puzzleVerifyView.puzzleXPercentage = sender.value;\n}\n\n```\n\n### API\n#### Puzzle pattern types\n```\n/**\n * TTGPuzzleVerifyView pattern type\n */\ntypedef NS_ENUM(NSInteger, TTGPuzzleVerifyPattern) {\n    TTGPuzzleVerifyClassicPattern = 0, // Default\n    TTGPuzzleVerifySquarePattern,\n    TTGPuzzleVerifyCirclePattern,\n    TTGPuzzleVerifyCustomPattern\n};\n\n// Puzzle pattern, default is TTGPuzzleVerifyClassicPattern\n@property (nonatomic, assign) TTGPuzzleVerifyPattern puzzlePattern;\n\n// Custom path for puzzle shape. Only work when puzzlePattern is TTGPuzzleVerifyCustomPattern\n@property (nonatomic, strong) UIBezierPath *customPuzzlePatternPath;\n```\n\n#### Complete the puzzle with animation\n```\n/**\n Complete verification. Call this with set the puzzle to its original position and fill the blank.\n\n @param withAnimation if show animation\n */\n- (void)completeVerificationWithAnimation:(BOOL)withAnimation;\n```\n\n#### Callback\n```\n/**\n * Verification changed callback delegate\n */\n@protocol TTGPuzzleVerifyViewDelegate \u003cNSObject\u003e\n@optional\n- (void)puzzleVerifyView:(TTGPuzzleVerifyView *)puzzleVerifyView didChangedVerification:(BOOL)isVerified;\n\n- (void)puzzleVerifyView:(TTGPuzzleVerifyView *)puzzleVerifyView didChangedPuzzlePosition:(CGPoint)newPosition\n             xPercentage:(CGFloat)xPercentage yPercentage:(CGFloat)yPercentage;\n@end\n\n// Callback block and delegate\n@property (nonatomic, weak) id \u003cTTGPuzzleVerifyViewDelegate\u003e delegate; // Callback delegate\n@property (nonatomic, copy) void (^verificationChangeBlock)(TTGPuzzleVerifyView *puzzleVerifyView, BOOL isVerified); // verification changed callback block\n```\n\n#### Puzzle image\n```\n@property (nonatomic, strong) UIImage *image; // Image for verification\n```\n\n#### Puzzle size and position\n```\n// Puzzle rect size，not for TTGPuzzleVerifyCustomPattern pattern\n@property (nonatomic, assign) CGSize puzzleSize;\n\n// Puzzle blank position\n@property (nonatomic, assign) CGPoint puzzleBlankPosition;\n\n// Puzzle current position\n@property (nonatomic, assign) CGPoint puzzlePosition;\n\n// Puzzle current X and Y position percentage, range: [0, 1]\n@property (nonatomic, assign) CGFloat puzzleXPercentage;\n@property (nonatomic, assign) CGFloat puzzleYPercentage;\n```\n\n#### Puzzle verification\n```\n// Verification\n@property (nonatomic, assign) CGFloat verificationTolerance; // Verification tolerance, default is 8\n@property (nonatomic, assign, readonly) BOOL isVerified; // Verification boolean\n```\n\n#### Style\n```\n/**\n * Style\n */\n\n// Puzzle blank alpha, default is 0.5\n@property (nonatomic, assign) CGFloat puzzleBlankAlpha;\n\n// Puzzle blank inner shadow\n@property (nonatomic, strong) UIColor *puzzleBlankInnerShadowColor; // Default: black\n@property (nonatomic, assign) CGFloat puzzleBlankInnerShadowRadius; // Default: 4\n@property (nonatomic, assign) CGFloat puzzleBlankInnerShadowOpacity; // Default: 0.5\n@property (nonatomic, assign) CGSize puzzleBlankInnerShadowOffset; // Default: (0, 0)\n\n// Puzzle shadow\n@property (nonatomic, strong) UIColor *puzzleShadowColor; // Default: black\n@property (nonatomic, assign) CGFloat puzzleShadowRadius; // Default: 4\n@property (nonatomic, assign) CGFloat puzzleShadowOpacity; // Default: 0.5\n@property (nonatomic, assign) CGSize puzzleShadowOffset; // Default: (0, 0)\n```\n\n## Example\nFor more information, you can download the zip and run the example.\n\n## Author\n\nzekunyan, zekunyan@163.com\n\n## License\n\nTTGPuzzleVerify is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzekunyan%2Fttgpuzzleverify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzekunyan%2Fttgpuzzleverify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzekunyan%2Fttgpuzzleverify/lists"}