Skip to content

Commit

Permalink
Improvad Nameable
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrommcarrasco committed Mar 8, 2019
1 parent ebfb6e7 commit 77da483
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Sucrose.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.swift_version = "4.2"
s.name = "Sucrose"
s.version = "2.2.0"
s.version = "2.3.0"
s.summary = "🍬 Everyday sugar"
s.description = "Collection of handy methods & objects"

Expand Down
24 changes: 20 additions & 4 deletions Sucrose.xcodeproj/project.pbxproj
Expand Up @@ -26,9 +26,11 @@
20D4D27B21E692EA00A3F80A /* UIViewUnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20D4D27A21E692EA00A3F80A /* UIViewUnitTests.swift */; };
20D4D27D21E6940000A3F80A /* UIViewControllerUnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20D4D27C21E6940000A3F80A /* UIViewControllerUnitTests.swift */; };
531857812215A59800009D11 /* UICollectionView+Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531857802215A59800009D11 /* UICollectionView+Cell.swift */; };
531857832215A5D700009D11 /* UIView+Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531857822215A5D700009D11 /* UIView+Name.swift */; };
531857832215A5D700009D11 /* UIView+Nameable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531857822215A5D700009D11 /* UIView+Nameable.swift */; };
531857852215AF6C00009D11 /* UITableView+Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531857842215AF6C00009D11 /* UITableView+Cell.swift */; };
531857872215B5BC00009D11 /* UIView+Shape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531857862215B5BC00009D11 /* UIView+Shape.swift */; };
537A660D2232AFFF00D9C2B7 /* Nameable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 537A660C2232AFFF00D9C2B7 /* Nameable.swift */; };
537A660F2232B14800D9C2B7 /* UIViewController+Nameable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 537A660E2232B14800D9C2B7 /* UIViewController+Nameable.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -64,9 +66,11 @@
20D4D27A21E692EA00A3F80A /* UIViewUnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewUnitTests.swift; sourceTree = "<group>"; };
20D4D27C21E6940000A3F80A /* UIViewControllerUnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerUnitTests.swift; sourceTree = "<group>"; };
531857802215A59800009D11 /* UICollectionView+Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UICollectionView+Cell.swift"; sourceTree = "<group>"; };
531857822215A5D700009D11 /* UIView+Name.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Name.swift"; sourceTree = "<group>"; };
531857822215A5D700009D11 /* UIView+Nameable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Nameable.swift"; sourceTree = "<group>"; };
531857842215AF6C00009D11 /* UITableView+Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Cell.swift"; sourceTree = "<group>"; };
531857862215B5BC00009D11 /* UIView+Shape.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Shape.swift"; sourceTree = "<group>"; };
537A660C2232AFFF00D9C2B7 /* Nameable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Nameable.swift; sourceTree = "<group>"; };
537A660E2232B14800D9C2B7 /* UIViewController+Nameable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Nameable.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -109,6 +113,7 @@
20D4D23821E67CEF00A3F80A /* Sucrose */ = {
isa = PBXGroup;
children = (
537A660B2232AFA800D9C2B7 /* Protocols */,
20D4D26021E67FFD00A3F80A /* Objects */,
20D4D25221E67E9900A3F80A /* Extensions */,
20D4D23A21E67CEF00A3F80A /* Info.plist */,
Expand Down Expand Up @@ -137,10 +142,11 @@
20D4D25A21E67F3D00A3F80A /* UIStackView+Hierarchy.swift */,
531857842215AF6C00009D11 /* UITableView+Cell.swift */,
20D4D25C21E67F5C00A3F80A /* UIView+Hierarchy.swift */,
531857822215A5D700009D11 /* UIView+Name.swift */,
531857822215A5D700009D11 /* UIView+Nameable.swift */,
20D4D26B21E688F700A3F80A /* UIView+Optimize.swift */,
531857862215B5BC00009D11 /* UIView+Shape.swift */,
20D4D25E21E67FAA00A3F80A /* UIViewController+Hierarchy.swift */,
537A660E2232B14800D9C2B7 /* UIViewController+Nameable.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand All @@ -167,6 +173,14 @@
path = Extensions;
sourceTree = "<group>";
};
537A660B2232AFA800D9C2B7 /* Protocols */ = {
isa = PBXGroup;
children = (
537A660C2232AFFF00D9C2B7 /* Nameable.swift */,
);
path = Protocols;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -277,16 +291,18 @@
buildActionMask = 2147483647;
files = (
20D4D25121E67E5600A3F80A /* Collection+SafeIndex.swift in Sources */,
537A660D2232AFFF00D9C2B7 /* Nameable.swift in Sources */,
531857812215A59800009D11 /* UICollectionView+Cell.swift in Sources */,
20D4D26821E6858600A3F80A /* String+Localizable.swift in Sources */,
20D4D25D21E67F5C00A3F80A /* UIView+Hierarchy.swift in Sources */,
20D4D25721E67ED000A3F80A /* NSObject+Create.swift in Sources */,
531857852215AF6C00009D11 /* UITableView+Cell.swift in Sources */,
537A660F2232B14800D9C2B7 /* UIViewController+Nameable.swift in Sources */,
20D4D26C21E688F700A3F80A /* UIView+Optimize.swift in Sources */,
20D4D25921E67F0600A3F80A /* UIButton+Init.swift in Sources */,
20D4D26221E6800900A3F80A /* Weak.swift in Sources */,
20D4D25F21E67FAA00A3F80A /* UIViewController+Hierarchy.swift in Sources */,
531857832215A5D700009D11 /* UIView+Name.swift in Sources */,
531857832215A5D700009D11 /* UIView+Nameable.swift in Sources */,
20D4D25B21E67F3D00A3F80A /* UIStackView+Hierarchy.swift in Sources */,
531857872215B5BC00009D11 /* UIView+Shape.swift in Sources */,
20D4D26A21E6860500A3F80A /* Optional+String.swift in Sources */,
Expand Down
@@ -1,5 +1,5 @@
//
// UIView+Name.swift
// UIView+Nameable.swift
// Sucrose
//
// Created by Pedro Carrasco on 14/02/2019.
Expand All @@ -8,7 +8,4 @@

import UIKit

extension UIView {

public static var name: String { return String(describing: self) }
}
extension UIView: Nameable { }
11 changes: 11 additions & 0 deletions Sucrose/Extensions/UIViewController+Nameable.swift
@@ -0,0 +1,11 @@
//
// UIViewController+Nameable.swift
// Sucrose
//
// Created by Pedro Carrasco on 08/03/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import UIKit

extension UIViewController: Nameable { }
20 changes: 20 additions & 0 deletions Sucrose/Protocols/Nameable.swift
@@ -0,0 +1,20 @@
//
// Nameable.swift
// Sucrose
//
// Created by Pedro Carrasco on 08/03/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import Foundation

public protocol Nameable {
static var name: String { get }
}

extension Nameable {

public static var name: String {
return String(describing: self)
}
}

0 comments on commit 77da483

Please sign in to comment.