LayoutLoopHunter - Runtime-based setup for tracking autolayout feedback loops

Overview

LayoutLoopHunter

CI Status Version License Platform

img

The library helps to catch the OOMs caused by Autolayout Feedback Loop by replicating the behavior of UIViewLayoutFeedbackLoopDebuggingThreshold in the live code.

This is the final result of the runtime tutorial on AppCoda.

Installation

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

pod 'LayoutLoopHunter'

and run pod install in your terminal.

Alternatively, you can manually add the files from the LayoutLoopHunter directory to your project.

Usage

Please use the setUp method to set up tracking for your UIView:

static func setUp(for view: UIView, threshold: Int = 100, onLoop: @escaping () -> ())

The callback will be called when the layoutSubviews() method is called a certain amount of times in a single run loop.

Example

LayoutLoopHunter.setUp(for: view) {
    print("Hello, world")
}

Author

Ruslan Serebriakov

Twitter: @rsrbk123

Check out my other libraries

SmileToUnlock - this library uses ARKit Face Tracking in order to catch a user's smile..
SRCountdownTimer - a simple circle countdown with a configurable timer.
SRAttractionsMap - the map with attractions on which you can click and see the full description.

License

MIT License

Copyright (c) 2019 Ruslan Serebriakov [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
Tiny Swift DSL for Autolayout

SwiftAutoLayout SwiftAutoLayout is a tiny DSL for Autolayout intended to provide a more declarative way to express layout constraints. Here's a quick

An autolayout library for the damn fine citizens of San Diego.
An autolayout library for the damn fine citizens of San Diego.

Anchorman Do you think autolayout has to be hard? Nah. NSLayoutAnchor is pretty neat! But it's still a bit tedious of an API. Try writing .translatesA

Minimal AutoLayout convenience layer. Program constraints succinctly.

MiniLayout Minimal AutoLayout convenience layer. Program constraints succinctly. Usage Put label over textField // using MiniLayout: view.constrain(la

A AutoLayout Utility for iOS

QLayout is an Utility to make Auto Layout easy on iOS. Contents Requirements Installation Usage Credits License Requirements iOS 8.0+ Swift 3.0+ Insta

AutoLayout Micro DSL SPM from Chris Eidhof's article

EasyAutoLayout Intro EasyAutoLayout is a small framework built using the ideas presented in the article called Autolayout Micro DSL by Chris Eidhof. I

FrameLayoutKit is a super fast and easy to use autolayout kit
FrameLayoutKit is a super fast and easy to use autolayout kit

FrameLayoutKit FrameLayout is a super fast and easy to use layout library for iOS and tvOS. For Objective-C version: NKFrameLayoutKit (Deprecated, not

SwiftLayout - View hierarchy and autolayout DSL library

SwiftLayout view hierarchy and autolayout DSL library goal 뷰의 계층구조와 constraint 관

An extension that simplifies the work with Swift AutoLayout by writing cleaner, more natural and easy-reading code.

Installation For now you're able to clone repo in your project or download ZIP folder manually. git clone https://github.com/votehserxam/AutoLayout.gi

UIView based progress bar that shows a progress based on duration in seconds

DurationProgressBar Create a progress bar based on a duration in seconds. The view is fully customisable. Install Add this repository to your swift pa

Comments
  • There's no Layout  loop occur in example

    There's no Layout loop occur in example

    I used the following example code in AppCoda

    
    class ViewController: UIViewController {    
        override func viewDidLoad() {        
                 super.viewDidLoad()         
                LayoutLoopHunter.setUp(for: view) {            
                       print("Hello, world")        
                } 
        }     
       override func viewDidLayoutSubviews(){       
              super.viewDidLayoutSubviews()        
              view.setNeedsLayout() // loop creation    
        }
    }
    

    but there's no layout loop occur when i execute this example. And layoutSubviews block was only executed two times.

    opened by archerLj 0
Releases(1.0)
Owner
Ruslan Serebriakov
Ruslan Serebriakov
Write concise Autolayout code

Winner of Hacking with Swift Recommended award You + Stevia = ?? ?? Write concise, readable layouts ?? Reduce your maintenance time ?? Compose your st

Fresh 3.3k Jan 6, 2023
📱AutoLayout can be set differently for each device

DeviceLayout DeviceLayout is a Swift framework that lets you set Auto Layout constraints's differently for each device Using only IBInspector of Xcode

Cruz 171 Oct 11, 2022
An easier and faster way to code Autolayout

EZAnchor 中文介绍 An easier way to code Autolayout Are you annoyed of coding .active = true while using Autolayout Anchors over and over again? Are you an

Alex.Liu 25 Feb 20, 2022
MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class.

MisterFusion MisterFusion makes more easier to use AutoLayout in Swift & Objective-C code. Features Simple And Concise Syntax Use in Swift and Objecti

Taiki Suzuki 316 Nov 17, 2022
The fast path to autolayout views in code

NorthLayout The fast path to autolayout views in code Talks https://speakerdeck.com/banjun/auto-layout-with-an-extended-visual-format-language at AltC

banjun 36 Jul 15, 2022
A Swift Autolayout DSL for iOS & OS X

SnapKit is a DSL to make Auto Layout easy on both iOS and OS X. ⚠️ To use with Swift 4.x please ensure you are using >= 4.0.0 ⚠️ ⚠️ To use with Swift

null 19.1k Jan 2, 2023
🏗 MondrianLayout - describing structured layout for AutoLayout

?? A DSL based layout builder for AutoLayout

Muukii 155 Dec 10, 2022
This "Calculator" application is a simple one screen design of calculator screen i have made this single screen design application just to practice AutoLayout concepts.

Calculator Layout This "Calculator" application is a simple one screen design of calculator screen i have made this single screen design application j

Chetan Parate 1 Oct 29, 2021
Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout

Masonry Masonry is still actively maintained, we are committed to fixing bugs and merging good quality PRs from the wider community. However if you're

null 18k Jan 5, 2023
A bit of steroids for AutoLayout, powered by Swift.

AutoLayoutPlus AutoLayoutPlus is a Swift library consisting in a set of extensions to help dealing with Auto Layout programatically. With AutoLayoutPl

Rui Costa 27 Jul 25, 2022