Latest 1.1.0
Homepage https://github.com/olddonkey/ODUIThreadGuard
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit
Authors

ODUIThreadGuard is a guard to help check if you make UI changes not in main thread.

Carthage compatible
CocoaPods Support
Swift Version
License MIT

ODUIThreadGuard is a guard to help check if you make UI changes not in main thread.
Highly recommend you add this file to your project as early as possible.

ScreenShot

Features

  • [x] Passive implementation
  • [x] Throw an assertion if setNeedsDisplay, setNeedsLayout, or setNeedsDisplayInRect: is called for instantiation of any UIView
  • [x] Get the thread stack to help you locate where you make the mistake

Usage

No matter which way you use ODUIThreadGuard, no need to import any files, it is a extension of UIView, so it will work automatically.

CocoaPods

You can use CocoaPods to install ODUIThreadGuard by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'ODUIThreadGuard'

Then drop ODUIThreadGuard.swift into your porject.

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/YourLibrary.framework to an iOS project.

github "olddonkey/ODUIThreadGuard"

Manually

  1. Download and drop ODUIThreadGuard.swift in your project.
  2. Congratulations!

You can change the pre compile flag to change the setting, in default, this only runs in DEBUG mode, so won’t affect users in Release.

Requirements

  • iOS 8.0+
  • Swift 3

The main development of ODUIThreadGuard is based on Swift 3.

Contact

Follow and contact me through email. If you find an issue, just open a ticket on it. Pull requests are warmly welcome as well.

License

ODUIThreadGuard is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "ODUIThreadGuard",
    "version": "1.1.0",
    "summary": "ODUIThreadGuard is a guard to help me check if you make UI changes not in main thread.",
    "description": "ODUIThreadGuard is a guard to help me check if you make UI changes not in main thread. Highly recommand you add this file to your project as early as possible.",
    "homepage": "https://github.com/olddonkey/ODUIThreadGuard",
    "screenshots": "https://raw.githubusercontent.com/olddonkey/ODUIThreadGuard/master/DemoScreenShot.jpeg",
    "license": "MIT",
    "authors": {
        "olddonkey": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/olddonkey/ODUIThreadGuard.git",
        "tag": "1.1.0"
    },
    "source_files": "Sources/*.swift",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This