<commit_before>//
//  LGMagnifyingLinearFlowLayout.swift
//
//  Created by <NAME> on 16/08/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit

public class LGMagnifyingLinearFlowLayout: UICollectionViewFlowLayout {
    
    private var lastCollectionViewSize: CGSize = CGSizeZero
    
    public var scalingOffset: CGFloat = 200 //for offsets >= scalingOffset scale factor is minimumScaleFactor
    public var minimumScaleFactor: CGFloat = 0.7
    public var scaleItems: Bool = true

    public override init() {
        super.init()
        
        setup()
    }
    
    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        
        setup()
    }
    
    func setup() {
        self.scrollDirection = .Horizontal
    }

    override public func invalidateLayoutWithContext(context: UICollectionViewLayoutInvalidationContext) {
        super.invalidateLayoutWithContext(context)
        
        guard let collectionView = self.collectionView else { return }
        let currentCollectionViewSize = collectionView.bounds.size
        
        if !CGSizeEqualToSize(currentCollectionViewSize, self.lastCollectionViewSize) {
            self.configureInset()
            self.lastCollectionViewSize = currentCollectionViewSize
        }
    }<commit_msg>Move contentInset configuration to prepareLayout<commit_after>//
//  LGMagnifyingLinearFlowLayout.swift
//
//  Created by <NAME> on 16/08/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit

public class LGMagnifyingLinearFlowLayout: UICollectionViewFlowLayout {
    
    private var lastCollectionViewSize: CGSize = CGSizeZero
    
    public var scalingOffset: CGFloat = 200 //for offsets >= scalingOffset scale factor is minimumScaleFactor
    public var minimumScaleFactor: CGFloat = 0.7
    public var scaleItems: Bool = true

    public override init() {
        super.init()
        
        setup()
    }
    
    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        
        setup()
    }
    
    func setup() {
        self.scrollDirection = .Horizontal
    }
    
    public override func prepareLayout() {
        super.prepareLayout()
        
        guard let collectionView = self.collectionView else { return }
        
        let currentCollectionViewSize = collectionView.bounds.size
        if !CGSizeEqualToSize(currentCollectionViewSize, self.lastCollectionViewSize) {
            self.configureInset()
            self.lastCollectionViewSize = currentCollectionViewSize
        }
    }
{'fraction_non_alphanumeric': 0.07391640866873066, 'fraction_numerical': 0.011609907120743035, 'mean_word_length': 2.570441988950276, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1117302', 'n_tokens_mistral': 711, 'n_tokens_neox': 682, 'n_words': 173}