Skip to content

Commit

Permalink
Refactor project structure and adding tvOS compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
abel-coding committed Aug 18, 2017
1 parent cab044b commit 7f10a29
Show file tree
Hide file tree
Showing 150 changed files with 1,693 additions and 1,232 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

extension Resources: DocumentChildsProcessor {
public func processDocument(childs: DocumentChildVisitor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

@objc public protocol ObjectConstructor {
func parametersKeys() -> [String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

public protocol KeyValueAccesible {
func resolveValue(forKey key: String) -> Any?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2017 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

extension NSObject: KeyValueAccesible {
@nonobjc public func resolveValue(forKey key: String) -> Any? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation
import CoreGraphics

// MARK: IntMaxConvertible Protocol

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

class PropertyHelper {

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

open class MutableCollection<T>: NSObject, Sequence, NSCopying {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,10 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

open class ReflectionHelper {

class func logBundle(_ bundle: Foundation.Bundle) {
print(bundle.bundleIdentifier ?? "")
print(bundle.bundlePath)
}

class func logBundleInfo() {
let main = Foundation.Bundle.main
logBundle(main)
let path = main.path(forResource: "CardResources", ofType: "xml")
print(path ?? "")
print("------------")
let apps = Foundation.Bundle.allBundles
let frameworks = Foundation.Bundle.allFrameworks
var bundles: [Foundation.Bundle] = []
bundles.append(contentsOf: apps)
bundles.append(contentsOf: frameworks)
for bundle in bundles {
logBundle(bundle)
}
}

// MARK: Bundle

static let availiableBundles = Foundation.Bundle.allBundles + Foundation.Bundle.allFrameworks
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import UIKit

#if os(iOS)

public struct PerformanceInspectorFlags : OptionSet {
public let rawValue: Int

Expand Down Expand Up @@ -145,3 +147,5 @@ extension PerformanceInspector {
inspectorWindow = nil
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import UIKit

#if os(iOS)

class PerformanceInspectorViewController: UIViewController {

override func viewDidLoad() {
Expand Down Expand Up @@ -44,3 +46,5 @@ class PerformanceInspectorViewController: UIViewController {
fpsLabel.text = "\(fps) FPS"
}
}

#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ extension PanelBase {
// MARK: Initialize

struct Static {
#if os(iOS)
static var viewClassesToPatch: [AnyClass] = [UIView.self,
UIControl.self,
UILabel.self,
Expand All @@ -69,6 +70,19 @@ extension PanelBase {
UIScrollView.self,
UIVisualEffectView.self,
UIWebView.self]
#endif
#if os(tvOS)
static var viewClassesToPatch: [AnyClass] = [UIView.self,
UIControl.self,
UILabel.self,
UIButton.self,
UIImageView.self,
UIInputView.self,
UICollectionReusableView.self,
UICollectionViewCell.self,
UIScrollView.self,
UIVisualEffectView.self]
#endif
}

@nonobjc public static let patchedClasses: Int = {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

open class PathFromBundle: Object, TextDeserializer {
open static func deserialize(text: String?, service: TextDeserializerServiceProtocol) -> Any? {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

open class ObjectStyle: DefaultConstructor {
public required init() {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import CoreGraphics
import Foundation

// MARK: - CGRect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import UIKit

open class Color: Object, TextDeserializer {

#if os(iOS)
static let ColorsByName: [String: UIColor] = ["Black": UIColor.black,
"Blue": UIColor.blue,
"Brown": UIColor.brown,
Expand All @@ -27,6 +28,24 @@ open class Color: Object, TextDeserializer {
"Red": UIColor.red,
"White": UIColor.white,
"Yellow": UIColor.yellow]
#endif
#if os(tvOS)
static let ColorsByName: [String: UIColor] = ["Black": UIColor.black,
"Blue": UIColor.blue,
"Brown": UIColor.brown,
"Clear": UIColor.clear,
"Cyan": UIColor.cyan,
"DarkGray": UIColor.darkGray,
"Gray": UIColor.gray,
"Green": UIColor.green,
"LightGray": UIColor.lightGray,
"Magenta": UIColor.magenta,
"Orange": UIColor.orange,
"Purple": UIColor.purple,
"Red": UIColor.red,
"White": UIColor.white,
"Yellow": UIColor.yellow]
#endif

open static func deserialize(text: String?, service: TextDeserializerServiceProtocol) -> Any? {
guard let value = text else {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import Foundation

open class Nib: NSObject, TextDeserializer {
open let name: String
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import Foundation
import UIKit

open class UIButtonConstructor: ObjectConstructor {
private static let UIButtonTypeParameter = "type"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import Foundation
import UIKit

open class UICollectionViewConstructor: ObjectConstructor {
private static let LayoutParameter = "layout"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import Foundation
import UIKit

open class UIViewConstructor: ObjectConstructor {
private static let NibParameter = "nib"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import QuartzCore

open class ShapeLayer: CAShapeLayer {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Abel Sanchez. All rights reserved.
//

import UIKit
import CoreGraphics

open class Path: NSObject {
open let path: CGPath
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 7f10a29

Please sign in to comment.