<commit_before>//
//  DesignableXib.swift
//  HelsinkiOS-Demo
//
//  Created by <NAME> on 29/09/15.
//  Copyright © 2015 Qvik. All rights reserved.
//

import UIKit

class DesignableXib: UIView {
    var view: UIView!
    
    // MARK: Private methods
    
    private func getXibName() -> String {
        let className = NSStringFromClass(self.dynamicType) as String
        let nameParts = className.characters.split {$0 == "."}.map { String($0) }
        return nameParts[1] as String
    }
    
    private func loadViewFromNib(name: String) -> UIView {
        let bundle = NSBundle(forClass: self.dynamicType)
        let nib = UINib(nibName: name, bundle: bundle)
        
        // Assumes UIView is top level and only object in CustomView.xib file
        let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView
        return view
    }
    
    // MARK: Lifecycle
    
    required override init(frame: CGRect) {
        super.init(frame: frame)
        self.loadXibAndInit()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.loadXibAndInit()
    }
    
    override func prepareForInterfaceBuilder() {
        self.loadXibAndInit()
    }
    
    func loadXibAndInit() {
        let xibName = getXibName()
        
        view = loadViewFromNib(xibName)
        view.frame = bounds
        // Make the view stretch with containing view
        view.autoresizingMask = [UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight]
        
        addSubview(view)
        
        initView()
        setupView()
    }
    
    func initView() {
    }
    
    func setupView() {
    }<commit_msg>Removed prepareForInterfaceBuilder from base class<commit_after>//
//  DesignableXib.swift
//  HelsinkiOS-Demo
//
//  Created by <NAME> on 29/09/15.
//  Copyright © 2015 Qvik. All rights reserved.
//

import UIKit

class DesignableXib: UIView {
    var view: UIView!
    
    // MARK: Private methods
    
    private func getXibName() -> String {
        let className = NSStringFromClass(self.dynamicType) as String
        let nameParts = className.characters.split {$0 == "."}.map { String($0) }
        return nameParts[1] as String
    }
    
    private func loadViewFromNib(name: String) -> UIView {
        let bundle = NSBundle(forClass: self.dynamicType)
        let nib = UINib(nibName: name, bundle: bundle)
        
        // Assumes UIView is top level and only object in CustomView.xib file
        let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView
        return view
    }
    
    // MARK: Lifecycle
    
    required override init(frame: CGRect) {
        super.init(frame: frame)
        self.loadXibAndInit()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.loadXibAndInit()
    }
    
    func loadXibAndInit() {
        let xibName = getXibName()
        
        view = loadViewFromNib(xibName)
        view.frame = bounds
        // Make the view stretch with containing view
        view.autoresizingMask = [UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight]
        
        addSubview(view)
        
        initView()
        setupView()
    }
    
    func initView() {
    }
    
    func setupView() {
    }
{'fraction_non_alphanumeric': 0.09593984962406014, 'fraction_numerical': 0.008421052631578947, 'mean_word_length': 2.088207985143918, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6796478', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1016, 'n_words': 252}