Skip to content
UIView/UIWindow/UIScrollView/UITableView/UIWebView/WKWebView Extension to easily take snapshot image of visible or full content.
Swift Ruby
Branch: master
Clone or download
Latest commit 20d094e Apr 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example 修改bundle 名称 Jan 19, 2019
SnapshotKit 重构API Jan 19, 2019
fastlane 更新Fastfile Sep 9, 2018
.gitignore
.travis.yml Initial commit Sep 9, 2018
LICENSE Initial commit Sep 9, 2018
README.md update README Apr 24, 2019
SnapshotKit.podspec Bumped to version 0.2.0 Jan 19, 2019
_Pods.xcodeproj

README.md

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
    }
}

UIWebView/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.

You can’t perform that action at this time.