• Stars
    star
    133
  • Rank 271,007 (Top 6 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 6 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

UIView/UIWindow/UIScrollView/UITableView/UIWebView/WKWebView Extension to easily take snapshot image of visible or full content.

SnapshotKit

Version License Platform

A Kit that can make UIView/UIWindow/UIScrollView/UITableView/UIWebView/WKWebView to easily take snapshot image of visible or full content.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

UIView Example

func uiView_takeSnapshotOfVisibleContent() {
    let image = self.view.takeSnapshotOfVisibleContent()
    // edit image 
}

func uiView_sync_takeSnapshotOfFullContent() {
    let image = self.view.takeSnapshotOfFullContent()
    // edit image 
}

func uiView_async_takeSnapshotOfFullContent() {
    self.view.asyncTakeSnapshotOfFullContent { (image) in
      // edit image 
    }
}

UIScrollView Example

private func takeSnapshotOfVisibleContent() {
    let image = self.scrollView.takeSnapshotOfVisibleContent()
    // edit image
}

private func sync_takeSnapshotOfFullContent() {
    let image = self.scrollView.takeSnapshotOfFullContent()
    // edit image
}

private func async_takeSnapshotOfFullContent() {
    self.scrollView.asyncTakeSnapshotOfFullContent { (image) in
      // edit image
    }
}

UITableView Example

func uiTableView_takeSnapshotOfVisibleContent() {
    let image = self.tableView.takeSnapshotOfVisibleContent()
    // edit image
}

func uiTableView_sync_takeSnapshotOfFullContent() {
    let image = self.tableView.takeSnapshotOfFullContent()
    // edit image
}

func uiTableView_async_takeSnapshotOfFullContent() {
    self.tableView.asyncTakeSnapshotOfFullContent { (image) in
      // edit image
    }
}

WKWebView Example

private func takeSnapshotOfVisibleContent() {
    let image = self.webView.takeSnapshotOfVisibleContent()
    // edit image
}

private func sync_takeSnapshotOfFullContent() {
    let image = self.webView.takeSnapshotOfFullContent()
    // edit image
}

private func async_takeSnapshotOfFullContent_bySpliter() {
    self.webView.scrollView.asyncTakeSnapshotOfFullContent { (image) in
      // edit image
    }
}

private func async_takeSnapshotOfFullContent_byPrinter() {
    self.webView.asyncTakeSnapshotOfFullContent { (image) in
      // edit image
    }
}

Installation

SnapshotKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SnapshotKit'

License

SnapshotKit is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

AppRTCDemo

A WebRTC for iOS client demo. PS: It uses XMPP to build the signaling service.
Objective-C
114
star
2

LottieExample

lottie-iOS 应用示例
Objective-C
27
star
3

Flr

🚚 MIGRATED: This repo is deprecated now, and has been migrated to https://github.com/Fly-Mix/flr-cli
Ruby
18
star
4

DecorationViewDemo

UICollectionView-DecorationView Demo
Swift
10
star
5

r_dart_library

A core library of R class which is generated by Flr(https://github.com/Fly-Mix/flr-cli) in flutter project.
Dart
7
star
6

YKImageCropper

YKImageCropper can help you to crop the image according to the size you want.
Objective-C
4
star
7

YKPageControllerScrollView

UIViewController容器类滚动视图,支持UIViewControlle重用机制
Objective-C
2
star
8

ModalAlert

Erica Sadun's ModalAlert + Customized
Objective-C
2
star
9

NSObject-EasyCopy

a copy category for NSObject
Objective-C
2
star
10

GestureImageView

GestureImageView extendeds gesture function, can help you easily to get an imageView with Tap Event/Click Event, or LongPress Event and so on.
Objective-C
2
star
11

YKWebViewJavascriptBridge

基于 WKWebView+messageHandler+自定义协议 搭建的 WebViewJavascriptBridge
Objective-C
2
star
12

DynamicTencentOpenApi

这是一个把TencentOpenApi转换为动态库的“失败”示例
Objective-C
1
star
13

Xcodeprojfiler

Xcodeprojfiler is a CLI tooL which can help iOS developer to get the info of files which exist in the xcode project dir. For example, Xcodeprojfiler can scan the current xcode project dir and find out the files which are not included in xcworkspace.
Ruby
1
star