onmyway133 / Mainthreadguard
Licence: other
💂 Tracking UIKit access on main thread
Stars: ✭ 53
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Mainthreadguard
youtube-dl-nas
youtube download queue websocket server with login for private NAS.
Stars: ✭ 136 (+156.6%)
Mutual labels: queue, thread
Diskqueue
A thread-safe, multi-process(ish) persistent queue library for .Net and Mono
Stars: ✭ 66 (+24.53%)
Mutual labels: thread, queue
Rxjava Android Samples
Learning RxJava for Android by example
Stars: ✭ 7,520 (+14088.68%)
Mutual labels: thread
Core
Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.
Stars: ✭ 34 (-35.85%)
Mutual labels: queue
Storage Based Queue
Javascript queue library with persistent storage based queue mechanism for the browsers environments. Specially designed for offline.
Stars: ✭ 33 (-37.74%)
Mutual labels: queue
Webfsd
A simple HTTP server for mostly static content written in C
Stars: ✭ 50 (-5.66%)
Mutual labels: thread
Vsalert
An drop-in replacement for UIAlertController with more power and better looks.
Stars: ✭ 48 (-9.43%)
Mutual labels: thread
Libgenerics
libgenerics is a minimalistic and generic library for C basic data structures.
Stars: ✭ 42 (-20.75%)
Mutual labels: queue
Cockburst
一个高性能,可靠,异步的本地持久化队列实现;重启JVM、重启服务器、或者强制KILL进程时,队列里的数据不丢失;
Stars: ✭ 33 (-37.74%)
Mutual labels: queue
Laravel Queue Database Ph4
Laravel Database Queue with Optimistic locking
Stars: ✭ 37 (-30.19%)
Mutual labels: queue
Uploader
A lightweight and very configurable jQuery plugin for file uploading using ajax(a sync); includes support for queues, progress tracking and drag and drop.
Stars: ✭ 1,042 (+1866.04%)
Mutual labels: queue
Cracking The Coding Interview
Solutions for Cracking the Coding Interview - 6th Edition
Stars: ✭ 35 (-33.96%)
Mutual labels: queue
Python Parallel Programming Cookbook Cn
📖《Python Parallel Programming Cookbook》中文版
Stars: ✭ 978 (+1745.28%)
Mutual labels: thread
MainThreadGuard
Tracking UIKit access on main thread
Description
This is just a Swift port of PSPDFUIKitMainThreadGuard.m using swizzling on UIView
extension
Usage
Call Guard.setup
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// setup
Guard.setup()
return true
}
Features
It works by swizzling in the following methods
- setNeedsLayout
- setNeedsDisplay
- setNeedsDisplayInRect:
Try accessing UIKit from another thread and MainThreadGuard will assert
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.white
let label = UILabel()
view.addSubview(label)
DispatchQueue.global(qos: DispatchQoS.QoSClass.background).async {
label.text = "Setting text on background thread"
}
}
}
Xcode 9+
Xcode 9+ has Main Thread Checker, which detects invalid use of AppKit, UIKit, and other APIs from a background thread.
Installation
MainThreadGuard is available through CocoaPods. To install it, simply add the following line to your Podfile:
You should add this to Debug configuration only
pod "MainThreadGuard", git: 'https://github.com/onmyway133/MainThreadGuard', configurations: 'Debug'
Author
Khoa Pham, [email protected]
License
MainThreadGuard is available under the MIT license. See the LICENSE file for more info.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].