Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge branch 'deploy/1.9.0' into productive
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Feb 11, 2019
2 parents 8a40168 + 6ad5b3f commit 2838898
Show file tree
Hide file tree
Showing 29 changed files with 330 additions and 199 deletions.
84 changes: 0 additions & 84 deletions .projlint.yml

This file was deleted.

6 changes: 1 addition & 5 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ explicit_type_interface:
- local

file_header:
required_pattern: |
\/\/
\/\/ Created by [^\(\)\d\n]+ on \S{6,10}\.
\/\/ Copyright © \d{4} Flinesoft\. All rights reserved\.
\/\/
required_pattern: \/\/ Created by [^\(\)\d\n]+ on \S{6,10}\.

file_name:
suffix_pattern: "Extensions?|\\+.*"
Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,40 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]
### Added
- None.
### Changed
- None.
### Deprecated
- None.
### Removed
- None.
### Fixed
- None.
### Security
- None.


## [1.9.0] - 2019-02-11
### Added
- New `NibLoadable` protocol for loading `UIView` subclasses from XIB files both from code and IB files.
- New `RoundableView` IBDesignable with `cornerRadius` defined for use right within Interface Builder files.
- New `TemplateButton` IBDesignable with `image` always rendered as `.alwaysTemplate` for use right within IB files.
- New `TemplateImageView` IBDesignable with `image` always rendered as `.alwaysTemplate` for use right within IB files.
- New `visibleViewController` properties on `UIWindow` to get the currently presented view controller globally.
### Changed
- The `bindEdgesToSuperview` method now supports an optional `insets` parameter of type `UIEdgeInsets`
### Deprecated
- None.
### Removed
- None.
### Fixed
- None.
### Security
- None.


## [1.8.0] - 2018-10-31
### Added
- UITableViewExtension to dequeue cells, headers & footers with static typing.
via [#10](https://github.com/Flinesoft/HandyUIKit/pull/10) by [Murat Yilmaz](https://github.com/roccx)
### Changed
Expand Down
6 changes: 2 additions & 4 deletions Frameworks/HandyUIKit/ColorSpaces.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Created by Tim Wood on 10/9/15.
//
// Created by Tim Wood on 10/9/15.
// Copyright © 2018 Flinesoft. All rights reserved.
//
// Original source: https://github.com/timrwood/ColorSpaces
// Original source: https://github.com/timrwood/ColorSpaces
//

// swiftlint:disable all
Expand Down
5 changes: 1 addition & 4 deletions Frameworks/HandyUIKit/Extensions/CGPointExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Cihat Gündüz on 31.10.18.
// Copyright © 2018 Flinesoft. All rights reserved.
//
// Created by Cihat Gündüz on 31.10.18.

import UIKit

Expand Down
5 changes: 1 addition & 4 deletions Frameworks/HandyUIKit/Extensions/CGRectExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Cihat Gündüz on 31.10.18.
// Copyright © 2018 Flinesoft. All rights reserved.
//
// Created by Cihat Gündüz on 31.10.18.

import UIKit

Expand Down
5 changes: 1 addition & 4 deletions Frameworks/HandyUIKit/Extensions/CGSizeExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Cihat Gündüz on 31.10.18.
// Copyright © 2018 Flinesoft. All rights reserved.
//
// Created by Cihat Gündüz on 31.10.18.

import UIKit

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Cihat Gündüz on 19.02.17.
// Copyright © 2017 Flinesoft. All rights reserved.
//
// Created by Cihat Gündüz on 19.02.17.

import UIKit

Expand Down
5 changes: 1 addition & 4 deletions Frameworks/HandyUIKit/Extensions/StringExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Cihat Gündüz on 19.02.17.
// Copyright © 2017 Flinesoft. All rights reserved.
//
// Created by Cihat Gündüz on 19.02.17.

import UIKit

Expand Down
5 changes: 1 addition & 4 deletions Frameworks/HandyUIKit/Extensions/UIColorExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Cihat Gündüz on 29.01.17.
// Copyright © 2017 Flinesoft. All rights reserved.
//
// Created by Cihat Gündüz on 29.01.17.

import UIKit

Expand Down
5 changes: 1 addition & 4 deletions Frameworks/HandyUIKit/Extensions/UIImageExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Cihat Gündüz on 07.04.18.
// Copyright © 2018 Flinesoft. All rights reserved.
//
// Created by Cihat Gündüz on 07.04.18.

import UIKit

Expand Down
5 changes: 1 addition & 4 deletions Frameworks/HandyUIKit/Extensions/UITableViewExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Murat Yilmaz on 25.10.18.
// Copyright © 2018 Flinesoft. All rights reserved.
//
// Created by Murat Yilmaz on 25.10.18.

import UIKit

Expand Down
12 changes: 6 additions & 6 deletions Frameworks/HandyUIKit/Extensions/UIViewExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Created by Cihat Gündüz on 06.01.17.
// Copyright © 2017 Flinesoft. All rights reserved.
//
// Created by Cihat Gündüz on 06.01.17.

import UIKit

Expand Down Expand Up @@ -82,13 +79,16 @@ extension UIView {

/// Adds constraints to the superview so that this view has same size and position.
/// Note: This fails the build if the `superview` is `nil` – add it as a subview before calling this.
public func bindEdgesToSuperview() {
///
/// - Parameters:
/// - edgeInsets: Insets from the edge. Defaults to 0 on all edges.
public func bindEdgesToSuperview(insets: UIEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)) {
guard let superview = superview else {
preconditionFailure("`superview` was nil – call `addSubview(view: UIView)` before calling `bindEdgesToSuperview()` to fix this.")
}

translatesAutoresizingMaskIntoConstraints = false
["H:|-0-[subview]-0-|", "V:|-0-[subview]-0-|"].forEach { visualFormat in
["H:|-\(insets.left)-[subview]-\(insets.right)-|", "V:|-\(insets.top)-[subview]-\(insets.bottom)-|"].forEach { visualFormat in
superview.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: visualFormat,
Expand Down
33 changes: 33 additions & 0 deletions Frameworks/HandyUIKit/Extensions/UIWindowExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Created by Cihat Gündüz on 11.02.19.

import UIKit

extension UIWindow {
/// Returns the currently visible view controller if any reachable within the window.
public var visibleViewController: UIViewController? {
return UIWindow.visibleViewController(from: rootViewController)
}

/// Recursively follows navigation controllers, tab bar controllers and modal presented view controllers starting
/// from the given view controller to find the currently visible view controller.
///
/// - Parameters:
/// - viewController: The view controller to start the recursive search from.
/// - Returns: The view controller that is most probably visible on screen right now.
public static func visibleViewController(from viewController: UIViewController?) -> UIViewController? {
switch viewController {
case let navigationController as UINavigationController:
return UIWindow.visibleViewController(from: navigationController.visibleViewController ?? navigationController.topViewController)

case let tabBarController as UITabBarController:
return UIWindow.visibleViewController(from: tabBarController.selectedViewController)

case let presentingViewController where viewController?.presentedViewController != nil:
return UIWindow.visibleViewController(from: presentingViewController?.presentedViewController)

default:
return viewController
}
}
}

46 changes: 46 additions & 0 deletions Frameworks/HandyUIKit/IBDesignables/RoundableView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Created by Cihat Gündüz on 11.02.19.

import UIKit

@IBDesignable
public class RoundableView: UIView {
@IBInspectable public var cornerRadius: CGFloat = 0 {
didSet {
update()
}
}

override public init(frame: CGRect) {
super.init(frame: frame)
setup()
}

public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}

override public func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
setup()
update()
}

override public func awakeFromNib() {
super.awakeFromNib()
update()
}

override public func layoutSubviews() {
super.layoutSubviews()
update()
}

private func setup() {
clipsToBounds = true
}

private func update() {
layer.cornerRadius = cornerRadius
}
}
10 changes: 10 additions & 0 deletions Frameworks/HandyUIKit/IBDesignables/TemplateButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Created by Cihat Gündüz on 11.02.19.

import UIKit

@IBDesignable
public class TemplateButton: UIButton {
override public func setImage(_ image: UIImage?, for state: UIControl.State) {
super.setImage(image?.withRenderingMode(.alwaysTemplate), for: state)
}
}
16 changes: 16 additions & 0 deletions Frameworks/HandyUIKit/IBDesignables/TemplateImageView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Created by Cihat Gündüz on 11.02.19.

import UIKit

@IBDesignable
public class TemplateImageView: UIImageView {
override public var image: UIImage? {
get {
return super.image
}

set {
super.image = newValue?.withRenderingMode(.alwaysTemplate)
}
}
}
Loading

0 comments on commit 2838898

Please sign in to comment.