├── CHANGELOG.md ├── Docs ├── Cell.md ├── Remote.md ├── Layout.md └── Design.md ├── Pods ├── Headers │ └── Private │ │ ├── Quick │ │ ├── Quick.h │ │ ├── World.h │ │ ├── QCKDSL.h │ │ ├── QuickSpec.h │ │ ├── World+DSL.h │ │ ├── NSString+QCKSelectorName.h │ │ └── QuickConfiguration.h │ │ └── Nimble │ │ ├── DSL.h │ │ ├── Nimble.h │ │ └── NMBExceptionCapture.h ├── Target Support Files │ ├── Quick │ │ ├── Quick-prefix.pch │ │ ├── Quick.modulemap │ │ ├── Quick-dummy.m │ │ ├── Quick-umbrella.h │ │ ├── Quick.xcconfig │ │ └── Info.plist │ ├── Nimble │ │ ├── Nimble-prefix.pch │ │ ├── Nimble.modulemap │ │ ├── Nimble-dummy.m │ │ ├── Nimble-umbrella.h │ │ ├── Nimble.xcconfig │ │ └── Info.plist │ └── Pods-LeeGoTests │ │ ├── Pods-LeeGoTests.modulemap │ │ ├── Pods-LeeGoTests-dummy.m │ │ ├── Pods-LeeGoTests-umbrella.h │ │ ├── Pods-LeeGoTests.debug.xcconfig │ │ ├── Pods-LeeGoTests.release.xcconfig │ │ ├── Info.plist │ │ └── Pods-LeeGoTests-frameworks.sh ├── Nimble │ └── Sources │ │ └── Nimble │ │ ├── Nimble.h │ │ ├── Utils │ │ ├── Functional.swift │ │ ├── SourceLocation.swift │ │ ├── ExceptionCapture.swift │ │ └── Stringers.swift │ │ ├── objc │ │ ├── NMBExceptionCapture.h │ │ ├── CurrentTestCaseTracker.m │ │ └── NMBExceptionCapture.m │ │ ├── Matchers │ │ ├── BeVoid.swift │ │ ├── BeNil.swift │ │ ├── Match.swift │ │ ├── BeIdenticalTo.swift │ │ ├── BeLessThan.swift │ │ ├── BeAKindOf.swift │ │ ├── BeGreaterThan.swift │ │ ├── BeLessThanOrEqual.swift │ │ ├── BeAnInstanceOf.swift │ │ ├── BeGreaterThanOrEqualTo.swift │ │ ├── HaveCount.swift │ │ ├── BeginWith.swift │ │ ├── PostNotification.swift │ │ ├── SatisfyAnyOf.swift │ │ └── EndWith.swift │ │ ├── Adapters │ │ ├── AssertionDispatcher.swift │ │ ├── AdapterProtocols.swift │ │ ├── NimbleEnvironment.swift │ │ └── NimbleXCTestHandler.swift │ │ ├── FailureMessage.swift │ │ ├── Expectation.swift │ │ ├── DSL.swift │ │ └── Wrappers │ │ └── ObjCMatcher.swift ├── Manifest.lock └── Quick │ ├── Sources │ └── Quick │ │ ├── String+FileName.swift │ │ ├── Quick.h │ │ ├── Hooks │ │ ├── HooksPhase.swift │ │ ├── SuiteHooks.swift │ │ ├── Closures.swift │ │ └── ExampleHooks.swift │ │ ├── ErrorUtility.swift │ │ ├── NSBundle+CurrentTestBundle.swift │ │ ├── NSString+QCKSelectorName.h │ │ ├── World.h │ │ ├── ExampleMetadata.swift │ │ ├── Callsite.swift │ │ ├── Filter.swift │ │ ├── Configuration │ │ ├── QuickConfiguration.h │ │ └── QuickConfiguration.m │ │ ├── XCTestSuite+QuickTestSuiteBuilder.m │ │ ├── QuickTestSuite.swift │ │ ├── NSString+QCKSelectorName.m │ │ ├── DSL │ │ ├── World+DSL.h │ │ └── QCKDSL.m │ │ ├── QuickSpec.h │ │ ├── QuickSelectedTestSuiteBuilder.swift │ │ └── ExampleGroup.swift │ └── README.md ├── Medias ├── leego.gif ├── leego.jpg ├── blocks_sample.png ├── title_sample.png ├── tweet_sample.png ├── union_sample.png ├── complex_sample.png └── description_sample.png ├── Demo ├── LeeGo │ ├── Fonts │ │ ├── LmfrAppIcon.ttf │ │ ├── FetteEngschrift.otf │ │ ├── TheSansOsF-Bold.otf │ │ ├── TheSansOsF-Plain.otf │ │ ├── TheAntiquaB-W7Bold.otf │ │ ├── TheAntiquaB-W5Plain.otf │ │ ├── TheSansOsF-SemiBold.otf │ │ ├── TheSansOsF-SemiLight.otf │ │ ├── TheAntiquaB-W6SemiBold.otf │ │ ├── TheAntiquaB-W8ExtraBold.otf │ │ └── TheAntiquaB-W5PlainItalic.otf │ ├── Images.xcassets │ │ ├── Contents.json │ │ ├── Twitter │ │ │ ├── Contents.json │ │ │ ├── twitter_reply.imageset │ │ │ │ ├── ICN: Reply.png │ │ │ │ ├── ICN: Reply@2x.png │ │ │ │ ├── ICN: Reply@3x.png │ │ │ │ └── Contents.json │ │ │ ├── twitter_retweet.imageset │ │ │ │ ├── ICN: Retweet.png │ │ │ │ ├── ICN: Retweet@2x.png │ │ │ │ ├── ICN: Retweet@3x.png │ │ │ │ └── Contents.json │ │ │ └── twitter_favorite.imageset │ │ │ │ ├── ICN: Favorite.png │ │ │ │ ├── ICN: Favorite@2x.png │ │ │ │ ├── ICN: Favorite@3x.png │ │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── SampleItem.swift │ ├── ElementViewModel.swift │ ├── Element.swift │ ├── Info.plist │ ├── AppDelegate.swift │ ├── MainViewController.swift │ ├── DetailsViewController.swift │ ├── Tweet.swift │ ├── TwitterFeedViewController.swift │ ├── standard_brick.json │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── SamplesViewController.swift │ └── LeMondeNewsFeedViewController.swift ├── Pods │ ├── Target Support Files │ │ ├── LeeGo │ │ │ ├── LeeGo-prefix.pch │ │ │ ├── LeeGo.modulemap │ │ │ ├── LeeGo-dummy.m │ │ │ ├── LeeGo-umbrella.h │ │ │ ├── LeeGo.xcconfig │ │ │ └── Info.plist │ │ ├── Pods-LeeGo-Demo │ │ │ ├── Pods-LeeGo-Demo.modulemap │ │ │ ├── Pods-LeeGo-Demo-dummy.m │ │ │ ├── Pods-LeeGo-Demo-umbrella.h │ │ │ ├── Pods-LeeGo-Demo.debug.xcconfig │ │ │ ├── Pods-LeeGo-Demo.release.xcconfig │ │ │ ├── Info.plist │ │ │ ├── Pods-LeeGo-Demo-acknowledgements.markdown │ │ │ ├── Pods-LeeGo-Demo-acknowledgements.plist │ │ │ └── Pods-LeeGo-Demo-frameworks.sh │ │ └── Pods-LeeGo-Tests │ │ │ ├── Pods-LeeGo-Tests.modulemap │ │ │ ├── Pods-LeeGo-Tests-dummy.m │ │ │ ├── Pods-LeeGo-Tests-umbrella.h │ │ │ ├── Pods-LeeGo-Tests.debug.xcconfig │ │ │ ├── Pods-LeeGo-Tests.release.xcconfig │ │ │ ├── Info.plist │ │ │ ├── Pods-LeeGo-Tests-acknowledgements.markdown │ │ │ ├── Pods-LeeGo-Tests-acknowledgements.plist │ │ │ └── Pods-LeeGo-Tests-frameworks.sh │ ├── Manifest.lock │ ├── Local Podspecs │ │ └── LeeGo.podspec.json │ └── Pods.xcodeproj │ │ └── xcshareddata │ │ └── xcschemes │ │ └── LeeGo.xcscheme ├── LeeGo.xcodeproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Podfile ├── Podfile.lock ├── LeeGo.xcworkspace │ └── contents.xcworkspacedata └── Tests │ ├── Info.plist │ └── DemoTests.swift ├── LeeGoTests ├── TestMedia.xcassets │ ├── Contents.json │ └── Twitter │ │ ├── Contents.json │ │ ├── twitter_favorite.imageset │ │ ├── favorite.png │ │ ├── ICN: Favorite@2x.png │ │ ├── ICN: Favorite@3x.png │ │ └── Contents.json │ │ ├── twitter_reply.imageset │ │ ├── ICN: Reply.png │ │ ├── ICN: Reply@2x.png │ │ ├── ICN: Reply@3x.png │ │ └── Contents.json │ │ └── twitter_retweet.imageset │ │ ├── ICN: Retweet.png │ │ ├── ICN: Retweet@2x.png │ │ ├── ICN: Retweet@3x.png │ │ └── Contents.json ├── layout.json ├── Info.plist ├── LayoutSpec.swift ├── brick.json └── ComponentTypeSpec.swift ├── Podfile ├── LeeGo.xcodeproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── Podfile.lock ├── LeeGo.xcworkspace └── contents.xcworkspacedata ├── codecov.yml ├── Sources ├── Errors.swift ├── Core │ ├── Configurable.swift │ └── Composable.swift ├── Cell.swift └── Constraint.swift ├── Supporting Files ├── LeeGo.h └── Info.plist ├── .gitignore ├── .travis.yml ├── LICENSE └── LeeGo.podspec /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ----- 4 | 5 | -------------------------------------------------------------------------------- /Docs/Cell.md: -------------------------------------------------------------------------------- 1 | ## Cell 2 | #### Configurable dynamic height 3 | TODO -------------------------------------------------------------------------------- /Docs/Remote.md: -------------------------------------------------------------------------------- 1 | 2 | ## JSON Decodable 3 | ## JSON Encodable 4 | 5 | TODO -------------------------------------------------------------------------------- /Pods/Headers/Private/Quick/Quick.h: -------------------------------------------------------------------------------- 1 | ../../../Quick/Sources/Quick/Quick.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Quick/World.h: -------------------------------------------------------------------------------- 1 | ../../../Quick/Sources/Quick/World.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Nimble/DSL.h: -------------------------------------------------------------------------------- 1 | ../../../Nimble/Sources/Nimble/objc/DSL.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Nimble/Nimble.h: -------------------------------------------------------------------------------- 1 | ../../../Nimble/Sources/Nimble/Nimble.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Quick/QCKDSL.h: -------------------------------------------------------------------------------- 1 | ../../../Quick/Sources/Quick/DSL/QCKDSL.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Quick/QuickSpec.h: -------------------------------------------------------------------------------- 1 | ../../../Quick/Sources/Quick/QuickSpec.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Quick/World+DSL.h: -------------------------------------------------------------------------------- 1 | ../../../Quick/Sources/Quick/DSL/World+DSL.h -------------------------------------------------------------------------------- /Medias/leego.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Medias/leego.gif -------------------------------------------------------------------------------- /Medias/leego.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Medias/leego.jpg -------------------------------------------------------------------------------- /Medias/blocks_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Medias/blocks_sample.png -------------------------------------------------------------------------------- /Medias/title_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Medias/title_sample.png -------------------------------------------------------------------------------- /Medias/tweet_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Medias/tweet_sample.png -------------------------------------------------------------------------------- /Medias/union_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Medias/union_sample.png -------------------------------------------------------------------------------- /Medias/complex_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Medias/complex_sample.png -------------------------------------------------------------------------------- /Pods/Headers/Private/Nimble/NMBExceptionCapture.h: -------------------------------------------------------------------------------- 1 | ../../../Nimble/Sources/Nimble/objc/NMBExceptionCapture.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Quick/NSString+QCKSelectorName.h: -------------------------------------------------------------------------------- 1 | ../../../Quick/Sources/Quick/NSString+QCKSelectorName.h -------------------------------------------------------------------------------- /Medias/description_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Medias/description_sample.png -------------------------------------------------------------------------------- /Pods/Headers/Private/Quick/QuickConfiguration.h: -------------------------------------------------------------------------------- 1 | ../../../Quick/Sources/Quick/Configuration/QuickConfiguration.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Quick/Quick-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/LmfrAppIcon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/LmfrAppIcon.ttf -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/LeeGo/LeeGo-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Nimble/Nimble-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/FetteEngschrift.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/FetteEngschrift.otf -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheSansOsF-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheSansOsF-Bold.otf -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheSansOsF-Plain.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheSansOsF-Plain.otf -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheAntiquaB-W7Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheAntiquaB-W7Bold.otf -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheAntiquaB-W5Plain.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheAntiquaB-W5Plain.otf -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheSansOsF-SemiBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheSansOsF-SemiBold.otf -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheSansOsF-SemiLight.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheSansOsF-SemiLight.otf -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheAntiquaB-W6SemiBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheAntiquaB-W6SemiBold.otf -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheAntiquaB-W8ExtraBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheAntiquaB-W8ExtraBold.otf -------------------------------------------------------------------------------- /Demo/LeeGo/Fonts/TheAntiquaB-W5PlainItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Fonts/TheAntiquaB-W5PlainItalic.otf -------------------------------------------------------------------------------- /Docs/Layout.md: -------------------------------------------------------------------------------- 1 | ## Layout 2 | #### Layout with built-in UIStackView inspired methods 3 | #### Layout with raw `Visual Format Language` 4 | 5 | TODO -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | use_frameworks! 3 | 4 | target 'LeeGoTests', :exclusive => true do 5 | pod 'Quick' 6 | pod 'Nimble' 7 | end -------------------------------------------------------------------------------- /Pods/Target Support Files/Quick/Quick.modulemap: -------------------------------------------------------------------------------- 1 | framework module Quick { 2 | umbrella header "Quick-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/LeeGo/LeeGo.modulemap: -------------------------------------------------------------------------------- 1 | framework module LeeGo { 2 | umbrella header "LeeGo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Nimble/Nimble.modulemap: -------------------------------------------------------------------------------- 1 | framework module Nimble { 2 | umbrella header "Nimble-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Nimble/Nimble-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Nimble : NSObject 3 | @end 4 | @implementation PodsDummy_Nimble 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Quick/Quick-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Quick : NSObject 3 | @end 4 | @implementation PodsDummy_Quick 5 | @end 6 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/LeeGo/LeeGo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_LeeGo : NSObject 3 | @end 4 | @implementation PodsDummy_LeeGo 5 | @end 6 | -------------------------------------------------------------------------------- /Docs/Design.md: -------------------------------------------------------------------------------- 1 | 2 | ## API Design and the rational behind 3 | 4 | TODO 5 | 6 | Why 7 | How 8 | Roadmap 9 | 10 | - Semantic > Reusable 11 | - Maintainable 12 | - Brick name convention -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_reply.imageset/ICN: Reply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_reply.imageset/ICN: Reply.png -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_reply.imageset/ICN: Reply@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_reply.imageset/ICN: Reply@2x.png -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_reply.imageset/ICN: Reply@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_reply.imageset/ICN: Reply@3x.png -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet.png -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_favorite.imageset/favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_favorite.imageset/favorite.png -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_reply.imageset/ICN: Reply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_reply.imageset/ICN: Reply.png -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite.png -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet@2x.png -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet@3x.png -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/LeeGo/LeeGo-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double LeeGoVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char LeeGoVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_reply.imageset/ICN: Reply@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_reply.imageset/ICN: Reply@2x.png -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_reply.imageset/ICN: Reply@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_reply.imageset/ICN: Reply@3x.png -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet.png -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LeeGoTests/Pods-LeeGoTests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_LeeGoTests { 2 | umbrella header "Pods-LeeGoTests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite@2x.png -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/Demo/LeeGo/Images.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite@3x.png -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Pods-LeeGo-Demo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_LeeGo_Demo { 2 | umbrella header "Pods-LeeGo-Demo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet@2x.png -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_retweet.imageset/ICN: Retweet@3x.png -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Pods-LeeGo-Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_LeeGo_Tests { 2 | umbrella header "Pods-LeeGo-Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite@2x.png -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielPeart/LeeGo/HEAD/LeeGoTests/TestMedia.xcassets/Twitter/twitter_favorite.imageset/ICN: Favorite@3x.png -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LeeGoTests/Pods-LeeGoTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_LeeGoTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_LeeGoTests 5 | @end 6 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Pods-LeeGo-Demo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_LeeGo_Demo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_LeeGo_Demo 5 | @end 6 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Pods-LeeGo-Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_LeeGo_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_LeeGo_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /LeeGo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/LeeGo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Nimble.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NMBExceptionCapture.h" 3 | #import "DSL.h" 4 | 5 | FOUNDATION_EXPORT double NimbleVersionNumber; 6 | FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LeeGoTests/Pods-LeeGoTests-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_LeeGoTestsVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_LeeGoTestsVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Pods-LeeGo-Demo-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_LeeGo_DemoVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_LeeGo_DemoVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Pods-LeeGo-Tests-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_LeeGo_TestsVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_LeeGo_TestsVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Demo/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | use_frameworks! 3 | 4 | target 'LeeGo-Demo', :exclusive => true do 5 | pod "LeeGo", :path => "../" 6 | end 7 | 8 | target 'LeeGo-Tests', :exclusive => true do 9 | pod "LeeGo", :path => "../" 10 | end -------------------------------------------------------------------------------- /Demo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - LeeGo (0.4.1) 3 | 4 | DEPENDENCIES: 5 | - LeeGo (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | LeeGo: 9 | :path: ../ 10 | 11 | SPEC CHECKSUMS: 12 | LeeGo: 18682371139a748a1f81a27a0261a759f8960ad8 13 | 14 | COCOAPODS: 0.39.0 15 | -------------------------------------------------------------------------------- /Demo/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - LeeGo (0.4.1) 3 | 4 | DEPENDENCIES: 5 | - LeeGo (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | LeeGo: 9 | :path: ../ 10 | 11 | SPEC CHECKSUMS: 12 | LeeGo: 18682371139a748a1f81a27a0261a759f8960ad8 13 | 14 | COCOAPODS: 0.39.0 15 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Nimble (3.2.0) 3 | - Quick (0.9.1) 4 | 5 | DEPENDENCIES: 6 | - Nimble 7 | - Quick 8 | 9 | SPEC CHECKSUMS: 10 | Nimble: 703854335d181df169bbca9c97117b5cf8c47c1d 11 | Quick: a5221fc21788b6aeda934805e68b061839bc3165 12 | 13 | COCOAPODS: 0.39.0 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Nimble/Nimble-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "Nimble.h" 4 | #import "DSL.h" 5 | #import "NMBExceptionCapture.h" 6 | 7 | FOUNDATION_EXPORT double NimbleVersionNumber; 8 | FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; 9 | 10 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Nimble (3.2.0) 3 | - Quick (0.9.1) 4 | 5 | DEPENDENCIES: 6 | - Nimble 7 | - Quick 8 | 9 | SPEC CHECKSUMS: 10 | Nimble: 703854335d181df169bbca9c97117b5cf8c47c1d 11 | Quick: a5221fc21788b6aeda934805e68b061839bc3165 12 | 13 | COCOAPODS: 0.39.0 14 | -------------------------------------------------------------------------------- /LeeGo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Demo/LeeGo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Quick/Quick-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "QuickConfiguration.h" 4 | #import "QCKDSL.h" 5 | #import "Quick.h" 6 | #import "QuickSpec.h" 7 | 8 | FOUNDATION_EXPORT double QuickVersionNumber; 9 | FOUNDATION_EXPORT const unsigned char QuickVersionString[]; 10 | 11 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Utils/Functional.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension SequenceType { 4 | internal func all(fn: Generator.Element -> Bool) -> Bool { 5 | for item in self { 6 | if !fn(item) { 7 | return false 8 | } 9 | } 10 | return true 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | branch: master 3 | comment: 4 | layout: header, changes, diff 5 | coverage: 6 | ignore: 7 | - Demo/.* 8 | - Pods/.* 9 | - LeeGoTests/.* 10 | - Carthage/.* 11 | - build/.* 12 | - .*Tests.m 13 | - .*Tests.swift 14 | - .*Spec.m 15 | - .*Spec.swift 16 | status: 17 | patch: false 18 | 19 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/String+FileName.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension String { 4 | 5 | /** 6 | If the receiver represents a path, returns its file name with a file extension. 7 | */ 8 | var fileName: String? { 9 | return NSURL(string: self)?.URLByDeletingPathExtension?.lastPathComponent 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/LeeGo/LeeGo.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/LeeGo" "${PODS_ROOT}/Headers/Public" 3 | OTHER_LDFLAGS = -framework "UIKit" 4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Quick.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | //! Project version number for Quick. 4 | FOUNDATION_EXPORT double QuickVersionNumber; 5 | 6 | //! Project version string for Quick. 7 | FOUNDATION_EXPORT const unsigned char QuickVersionString[]; 8 | 9 | #import "QuickSpec.h" 10 | #import "QCKDSL.h" 11 | #import "QuickConfiguration.h" 12 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift: -------------------------------------------------------------------------------- 1 | /** 2 | A description of the execution cycle of the current example with 3 | respect to the hooks of that example. 4 | */ 5 | internal enum HooksPhase: Int { 6 | case NothingExecuted = 0 7 | case BeforesExecuting 8 | case BeforesFinished 9 | case AftersExecuting 10 | case AftersFinished 11 | } 12 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/objc/NMBExceptionCapture.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface NMBExceptionCapture : NSObject 5 | 6 | - (id)initWithHandler:(void(^)(NSException *))handler finally:(void(^)())finally; 7 | - (void)tryBlock:(void(^)())unsafeBlock; 8 | 9 | @end 10 | 11 | typedef void(^NMBSourceCallbackBlock)(BOOL successful); 12 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/ErrorUtility.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | @noreturn internal func raiseError(message: String) { 4 | #if _runtime(_ObjC) 5 | NSException(name: NSInternalInconsistencyException, reason: message, userInfo: nil).raise() 6 | #endif 7 | 8 | // This won't be reached when ObjC is available and the exception above is raisd 9 | fatalError(message) 10 | } 11 | -------------------------------------------------------------------------------- /Sources/Errors.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Errors.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 20/01/16. 6 | // 7 | // 8 | 9 | import Foundation 10 | 11 | internal enum JSONParseError: ErrorType { 12 | case UnexpectedKeyError(key: String), MismatchedTypeError(type: Any.Type, expectedType: Any.Type) 13 | } 14 | 15 | internal enum JSONConvertibleError: ErrorType { 16 | case UnexpectedBrickNameError(JSONDictionary) 17 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/Quick/Quick.xcconfig: -------------------------------------------------------------------------------- 1 | ENABLE_BITCODE = NO 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Quick" "${PODS_ROOT}/Headers/Public" 5 | OTHER_LDFLAGS = -framework "XCTest" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_ROOT = ${SRCROOT} 8 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Nimble/Nimble.xcconfig: -------------------------------------------------------------------------------- 1 | ENABLE_BITCODE = NO 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Nimble" "${PODS_ROOT}/Headers/Public" 5 | OTHER_LDFLAGS = -weak-lswiftXCTest -weak_framework "XCTest" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_ROOT = ${SRCROOT} 8 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift: -------------------------------------------------------------------------------- 1 | #if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) 2 | 3 | import Foundation 4 | 5 | extension NSBundle { 6 | 7 | /** 8 | Locates the first bundle with a '.xctest' file extension. 9 | */ 10 | internal static var currentTestBundle: NSBundle? { 11 | return allBundles().lazy 12 | .filter { 13 | $0.bundlePath.hasSuffix(".xctest") 14 | } 15 | .first 16 | } 17 | 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_reply.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ICN: Reply.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ICN: Reply@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ICN: Reply@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_reply.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ICN: Reply.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ICN: Reply@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ICN: Reply@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_retweet.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ICN: Retweet.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ICN: Retweet@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ICN: Retweet@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Supporting Files/LeeGo.h: -------------------------------------------------------------------------------- 1 | // 2 | // LeeGo.h 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 23/02/16. 6 | // Copyright © 2016 Victor Wang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for LeeGo. 12 | FOUNDATION_EXPORT double LeeGoVersionNumber; 13 | 14 | //! Project version string for LeeGo. 15 | FOUNDATION_EXPORT const unsigned char LeeGoVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/Twitter/twitter_favorite.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ICN: Favorite.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ICN: Favorite@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ICN: Favorite@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_favorite.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "favorite.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ICN: Favorite@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ICN: Favorite@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /LeeGoTests/TestMedia.xcassets/Twitter/twitter_retweet.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ICN: Retweet.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ICN: Retweet@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ICN: Retweet@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Pods-LeeGo-Demo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/LeeGo.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "LeeGo" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-LeeGo-Demo 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Pods-LeeGo-Demo.release.xcconfig: -------------------------------------------------------------------------------- 1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/LeeGo.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "LeeGo" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-LeeGo-Demo 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Pods-LeeGo-Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/LeeGo.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "LeeGo" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-LeeGo-Tests 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Pods-LeeGo-Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/LeeGo.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "LeeGo" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-LeeGo-Tests 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /LeeGoTests/layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "options" : [ 3 | "AlignAllCenterX", 4 | "DirectionLeadingToTrailing" 5 | ], 6 | "formats" : [ 7 | "H:|-left-[title]-spaceH-[image]-right", 8 | "V:|-top-[title]-(>=bottom)|", 9 | "V:|-top-[image]-(>=bottom)|" 10 | ], 11 | "metrics" : { 12 | "left" : 20, 13 | "bottom" : 20, 14 | "right" : 20, 15 | "spaceH" : 10, 16 | "custom_metrics" : 13, 17 | "top" : 20, 18 | "spaceV" : 10 19 | } 20 | } -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is Void. 4 | public func beVoid() -> MatcherFunc<()> { 5 | return MatcherFunc { actualExpression, failureMessage in 6 | failureMessage.postfixMessage = "be void" 7 | let actualValue: ()? = try actualExpression.evaluate() 8 | return actualValue != nil 9 | } 10 | } 11 | 12 | public func ==(lhs: Expectation<()>, rhs: ()) { 13 | lhs.to(beVoid()) 14 | } 15 | 16 | public func !=(lhs: Expectation<()>, rhs: ()) { 17 | lhs.toNot(beVoid()) 18 | } -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/objc/CurrentTestCaseTracker.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | SWIFT_CLASS("_TtC6Nimble22CurrentTestCaseTracker") 5 | @interface CurrentTestCaseTracker : NSObject 6 | + (CurrentTestCaseTracker *)sharedInstance; 7 | @end 8 | 9 | @interface CurrentTestCaseTracker (Register) @end 10 | 11 | @implementation CurrentTestCaseTracker (Register) 12 | 13 | + (void)load { 14 | CurrentTestCaseTracker *tracker = [CurrentTestCaseTracker sharedInstance]; 15 | [[XCTestObservationCenter sharedTestObservationCenter] addTestObserver:tracker]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/NSString+QCKSelectorName.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | QuickSpec converts example names into test methods. 5 | Those test methods need valid selector names, which means no whitespace, 6 | control characters, etc. This category gives NSString objects an easy way 7 | to replace those illegal characters with underscores. 8 | */ 9 | @interface NSString (QCKSelectorName) 10 | 11 | /** 12 | Returns a string with underscores in place of all characters that cannot 13 | be included in a selector (SEL) name. 14 | */ 15 | @property (nonatomic, readonly) NSString *qck_selectorName; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LeeGoTests/Pods-LeeGoTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Nimble.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Quick.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Nimble" -framework "Quick" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-LeeGoTests 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LeeGoTests/Pods-LeeGoTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Nimble.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Quick.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Nimble" -framework "Quick" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-LeeGoTests 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/World.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class ExampleGroup; 4 | @class ExampleMetadata; 5 | 6 | SWIFT_CLASS("_TtC5Quick5World") 7 | @interface World 8 | 9 | @property (nonatomic) ExampleGroup * __nullable currentExampleGroup; 10 | @property (nonatomic) ExampleMetadata * __nullable currentExampleMetadata; 11 | @property (nonatomic) BOOL isRunningAdditionalSuites; 12 | + (World * __nonnull)sharedWorld; 13 | - (void)configure:(void (^ __nonnull)(Configuration * __nonnull))closure; 14 | - (void)finalizeConfiguration; 15 | - (ExampleGroup * __nonnull)rootExampleGroupForSpecClass:(Class __nonnull)cls; 16 | - (NSArray * __nonnull)examplesForSpecClass:(Class __nonnull)specClass; 17 | @end 18 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/ExampleMetadata.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | A class that encapsulates information about an example, 5 | including the index at which the example was executed, as 6 | well as the example itself. 7 | */ 8 | final public class ExampleMetadata: NSObject { 9 | /** 10 | The example for which this metadata was collected. 11 | */ 12 | public let example: Example 13 | 14 | /** 15 | The index at which this example was executed in the 16 | test suite. 17 | */ 18 | public let exampleIndex: Int 19 | 20 | internal init(example: Example, exampleIndex: Int) { 21 | self.example = example 22 | self.exampleIndex = exampleIndex 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is nil. 4 | public func beNil() -> MatcherFunc { 5 | return MatcherFunc { actualExpression, failureMessage in 6 | failureMessage.postfixMessage = "be nil" 7 | let actualValue = try actualExpression.evaluate() 8 | return actualValue == nil 9 | } 10 | } 11 | 12 | #if _runtime(_ObjC) 13 | extension NMBObjCMatcher { 14 | public class func beNilMatcher() -> NMBObjCMatcher { 15 | return NMBObjCMatcher { actualExpression, failureMessage in 16 | return try! beNil().matches(actualExpression, failureMessage: failureMessage) 17 | } 18 | } 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift: -------------------------------------------------------------------------------- 1 | 2 | /// AssertionDispatcher allows multiple AssertionHandlers to receive 3 | /// assertion messages. 4 | /// 5 | /// @warning Does not fully dispatch if one of the handlers raises an exception. 6 | /// This is possible with XCTest-based assertion handlers. 7 | /// 8 | public class AssertionDispatcher: AssertionHandler { 9 | let handlers: [AssertionHandler] 10 | 11 | public init(handlers: [AssertionHandler]) { 12 | self.handlers = handlers 13 | } 14 | 15 | public func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { 16 | for handler in handlers { 17 | handler.assert(assertion, message: message, location: location) 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | *.xcscmblueprint 17 | profile 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | 23 | # Bundler 24 | .bundle 25 | 26 | Carthage 27 | # We recommend against adding the Pods directory to your .gitignore. However 28 | # you should judge for yourself, the pros and cons are mentioned at: 29 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 30 | # 31 | # Note: if you ignore the Pods directory, make sure to uncomment 32 | # `pod install` in .travis.yml 33 | # 34 | # Pods/ 35 | -------------------------------------------------------------------------------- /Demo/LeeGo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Protocol for the assertion handler that Nimble uses for all expectations. 4 | public protocol AssertionHandler { 5 | func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) 6 | } 7 | 8 | /// Global backing interface for assertions that Nimble creates. 9 | /// Defaults to a private test handler that passes through to XCTest. 10 | /// 11 | /// If XCTest is not available, you must assign your own assertion handler 12 | /// before using any matchers, otherwise Nimble will abort the program. 13 | /// 14 | /// @see AssertionHandler 15 | public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in 16 | return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() 17 | }() 18 | -------------------------------------------------------------------------------- /Demo/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LeeGoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Demo/LeeGo/SampleItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SampleItem.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 31/03/16. 6 | // Copyright © 2016 LeeGo. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import LeeGo 11 | 12 | struct SampleItem { 13 | let title: String 14 | let description: String 15 | 16 | init(title: String, description: String) { 17 | self.title = title 18 | self.description = description 19 | } 20 | } 21 | 22 | extension SampleItem: BrickDataSource { 23 | 24 | func update(targetView: UIView, with brick: Brick) { 25 | switch targetView { 26 | case let label as UILabel where brick == SimpleShowcase.title: 27 | label.text = self.title 28 | case let label as UILabel where brick == SimpleShowcase.description: 29 | label.text = self.description 30 | default: 31 | break 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Callsite.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | An object encapsulating the file and line number at which 5 | a particular example is defined. 6 | */ 7 | final public class Callsite: NSObject { 8 | /** 9 | The absolute path of the file in which an example is defined. 10 | */ 11 | public let file: String 12 | 13 | /** 14 | The line number on which an example is defined. 15 | */ 16 | public let line: UInt 17 | 18 | internal init(file: String, line: UInt) { 19 | self.file = file 20 | self.line = line 21 | } 22 | } 23 | 24 | /** 25 | Returns a boolean indicating whether two Callsite objects are equal. 26 | If two callsites are in the same file and on the same line, they must be equal. 27 | */ 28 | public func ==(lhs: Callsite, rhs: Callsite) -> Bool { 29 | return lhs.file == rhs.file && lhs.line == rhs.line 30 | } 31 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/objc/NMBExceptionCapture.m: -------------------------------------------------------------------------------- 1 | #import "NMBExceptionCapture.h" 2 | 3 | @interface NMBExceptionCapture () 4 | @property (nonatomic, copy) void(^handler)(NSException *exception); 5 | @property (nonatomic, copy) void(^finally)(); 6 | @end 7 | 8 | @implementation NMBExceptionCapture 9 | 10 | - (id)initWithHandler:(void(^)(NSException *))handler finally:(void(^)())finally { 11 | self = [super init]; 12 | if (self) { 13 | self.handler = handler; 14 | self.finally = finally; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)tryBlock:(void(^)())unsafeBlock { 20 | @try { 21 | unsafeBlock(); 22 | } 23 | @catch (NSException *exception) { 24 | if (self.handler) { 25 | self.handler(exception); 26 | } 27 | } 28 | @finally { 29 | if (self.finally) { 30 | self.finally(); 31 | } 32 | } 33 | } 34 | 35 | @end -------------------------------------------------------------------------------- /Supporting Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # podfile: Demo/Podfile 8 | 9 | env: 10 | global: 11 | - LANG=en_US.UTF-8 12 | - COCOAPODS_DISABLE_DETERMINISTIC_UUIDS=true 13 | 14 | cache: 15 | - bundler 16 | - cocoapods 17 | 18 | after_success: 19 | - bash <(curl -s https://codecov.io/bash) 20 | - sleep 5 21 | 22 | # before_install: 23 | # - gem install cocoapods # Since Travis is not always on latest version 24 | # - pod install --project-directory=Example 25 | before_install: 26 | - gem install xcpretty -N --no-ri --no-rdoc 27 | 28 | script: 29 | - set -o pipefail && xcodebuild clean test -workspace LeeGo.xcworkspace -scheme LeeGo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6s,OS=latest' -enableCodeCoverage YES -configuration Debug ONLY_ACTIVE_ARCH=YES | xcpretty 30 | - pod lib lint 31 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift: -------------------------------------------------------------------------------- 1 | /** 2 | A container for closures to be executed before and after all examples. 3 | */ 4 | final internal class SuiteHooks { 5 | internal var befores: [BeforeSuiteClosure] = [] 6 | internal var afters: [AfterSuiteClosure] = [] 7 | internal var phase: HooksPhase = .NothingExecuted 8 | 9 | internal func appendBefore(closure: BeforeSuiteClosure) { 10 | befores.append(closure) 11 | } 12 | 13 | internal func appendAfter(closure: AfterSuiteClosure) { 14 | afters.append(closure) 15 | } 16 | 17 | internal func executeBefores() { 18 | phase = .BeforesExecuting 19 | for before in befores { 20 | before() 21 | } 22 | phase = .BeforesFinished 23 | } 24 | 25 | internal func executeAfters() { 26 | phase = .AftersExecuting 27 | for after in afters { 28 | after() 29 | } 30 | phase = .AftersFinished 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Nimble/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.2.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Quick/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.9.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/LeeGo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.4.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LeeGoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sources/Core/Configurable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Configurable.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 21/02/16. 6 | // 7 | // 8 | 9 | import Foundation 10 | 11 | protocol Configurable { 12 | func setup(view: View, currentStyle: [Appearance], newStyle: [Appearance]) 13 | 14 | func lg_setupCustomStyle(style: [String: AnyObject]) 15 | func lg_removeCustomStyle(style: [String: AnyObject]) 16 | } 17 | 18 | 19 | extension Configurable { 20 | 21 | internal func setup(view: View, currentStyle: [Appearance] = [], newStyle: [Appearance]) { 22 | 23 | // if current appearance do not appeare in new style, then set them to default value 24 | // TODO: change style from Array to Set to gain some performance 25 | for old in currentStyle where !newStyle.contains(old) { 26 | old.apply(to: view, useDefaultValue: true) 27 | } 28 | 29 | for appearance in newStyle { 30 | appearance.apply(to: view) 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Demo/Tests/DemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DemoTests.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 23/02/16. 6 | // Copyright © 2016 LeeGo. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class DemoTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | // Use XCTAssert and related functions to verify your tests produce the correct results. 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // Ideally we would always use `StaticString` as the type for tracking the file name 4 | // that expectations originate from, for consistency with `assert` etc. from the 5 | // stdlib, and because recent versions of the XCTest overlay require `StaticString` 6 | // when calling `XCTFail`. Under the Objective-C runtime (i.e. building on Mac), we 7 | // have to use `String` instead because StaticString can't be generated from Objective-C 8 | #if _runtime(_ObjC) 9 | public typealias FileString = String 10 | #else 11 | public typealias FileString = StaticString 12 | #endif 13 | 14 | public final class SourceLocation : NSObject { 15 | public let file: FileString 16 | public let line: UInt 17 | 18 | override init() { 19 | file = "Unknown File" 20 | line = 0 21 | } 22 | 23 | init(file: FileString, line: UInt) { 24 | self.file = file 25 | self.line = line 26 | } 27 | 28 | override public var description: String { 29 | return "\(file):\(line)" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Filter.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | A mapping of string keys to booleans that can be used to 5 | filter examples or example groups. For example, a "focused" 6 | example would have the flags [Focused: true]. 7 | */ 8 | public typealias FilterFlags = [String: Bool] 9 | 10 | /** 11 | A namespace for filter flag keys, defined primarily to make the 12 | keys available in Objective-C. 13 | */ 14 | final public class Filter: NSObject { 15 | /** 16 | Example and example groups with [Focused: true] are included in test runs, 17 | excluding all other examples without this flag. Use this to only run one or 18 | two tests that you're currently focusing on. 19 | */ 20 | public class var focused: String { 21 | return "focused" 22 | } 23 | 24 | /** 25 | Example and example groups with [Pending: true] are excluded from test runs. 26 | Use this to temporarily suspend examples that you know do not pass yet. 27 | */ 28 | public class var pending: String { 29 | return "pending" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Victor Wang 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Utils/ExceptionCapture.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | #if !_runtime(_ObjC) 4 | // swift-corelibs-foundation doesn't provide NSException at all, so provide a dummy 5 | class NSException {} 6 | #endif 7 | 8 | // NOTE: This file is not intended to be included in the Xcode project. It 9 | // is picked up by the Swift Package Manager during its build process. 10 | 11 | /// A dummy reimplementation of the `NMBExceptionCapture` class to serve 12 | /// as a stand-in for build and runtime environments that don't support 13 | /// Objective C. 14 | internal class ExceptionCapture { 15 | let finally: (() -> Void)? 16 | 17 | init(handler: ((NSException!) -> Void)?, finally: (() -> Void)?) { 18 | self.finally = finally 19 | } 20 | 21 | func tryBlock(unsafeBlock: (() -> Void)) { 22 | // We have no way of handling Objective C exceptions in Swift, 23 | // so we just go ahead and run the unsafeBlock as-is 24 | unsafeBlock() 25 | 26 | finally?() 27 | } 28 | } 29 | 30 | /// Compatibility with the actual Objective-C implementation 31 | typealias NMBExceptionCapture = ExceptionCapture 32 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/Match.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | #if _runtime(_ObjC) 4 | 5 | /// A Nimble matcher that succeeds when the actual string satisfies the regular expression 6 | /// described by the expected string. 7 | public func match(expectedValue: String?) -> NonNilMatcherFunc { 8 | return NonNilMatcherFunc { actualExpression, failureMessage in 9 | failureMessage.postfixMessage = "match <\(stringify(expectedValue))>" 10 | 11 | if let actual = try actualExpression.evaluate() { 12 | if let regexp = expectedValue { 13 | return actual.rangeOfString(regexp, options: .RegularExpressionSearch) != nil 14 | } 15 | } 16 | 17 | return false 18 | } 19 | } 20 | 21 | extension NMBObjCMatcher { 22 | public class func matchMatcher(expected: NSString) -> NMBMatcher { 23 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 24 | let actual = actualExpression.cast { $0 as? String } 25 | return try! match(expected.description).matches(actual, failureMessage: failureMessage) 26 | } 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Hooks/Closures.swift: -------------------------------------------------------------------------------- 1 | // MARK: Example Hooks 2 | 3 | /** 4 | A closure executed before an example is run. 5 | */ 6 | public typealias BeforeExampleClosure = () -> () 7 | 8 | /** 9 | A closure executed before an example is run. The closure is given example metadata, 10 | which contains information about the example that is about to be run. 11 | */ 12 | public typealias BeforeExampleWithMetadataClosure = (exampleMetadata: ExampleMetadata) -> () 13 | 14 | /** 15 | A closure executed after an example is run. 16 | */ 17 | public typealias AfterExampleClosure = BeforeExampleClosure 18 | 19 | /** 20 | A closure executed after an example is run. The closure is given example metadata, 21 | which contains information about the example that has just finished running. 22 | */ 23 | public typealias AfterExampleWithMetadataClosure = BeforeExampleWithMetadataClosure 24 | 25 | // MARK: Suite Hooks 26 | 27 | /** 28 | A closure executed before any examples are run. 29 | */ 30 | public typealias BeforeSuiteClosure = () -> () 31 | 32 | /** 33 | A closure executed after all examples have finished running. 34 | */ 35 | public typealias AfterSuiteClosure = BeforeSuiteClosure 36 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class Configuration; 4 | 5 | /** 6 | Subclass QuickConfiguration and override the +[QuickConfiguration configure:] 7 | method in order to configure how Quick behaves when running specs, or to define 8 | shared examples that are used across spec files. 9 | */ 10 | @interface QuickConfiguration : NSObject 11 | 12 | /** 13 | This method is executed on each subclass of this class before Quick runs 14 | any examples. You may override this method on as many subclasses as you like, but 15 | there is no guarantee as to the order in which these methods are executed. 16 | 17 | You can override this method in order to: 18 | 19 | 1. Configure how Quick behaves, by modifying properties on the Configuration object. 20 | Setting the same properties in several methods has undefined behavior. 21 | 22 | 2. Define shared examples using `sharedExamples`. 23 | 24 | @param configuration A mutable object that is used to configure how Quick behaves on 25 | a framework level. For details on all the options, see the 26 | documentation in Configuration.swift. 27 | */ 28 | + (void)configure:(Configuration *)configuration; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this 4 | /// class' existance 5 | internal class NimbleEnvironment { 6 | static var activeInstance: NimbleEnvironment { 7 | get { 8 | let env = NSThread.currentThread().threadDictionary["NimbleEnvironment"] 9 | if let env = env as? NimbleEnvironment { 10 | return env 11 | } else { 12 | let newEnv = NimbleEnvironment() 13 | self.activeInstance = newEnv 14 | return newEnv 15 | } 16 | } 17 | set { 18 | NSThread.currentThread().threadDictionary["NimbleEnvironment"] = newValue 19 | } 20 | } 21 | 22 | // TODO: eventually migrate the global to this environment value 23 | var assertionHandler: AssertionHandler { 24 | get { return NimbleAssertionHandler } 25 | set { NimbleAssertionHandler = newValue } 26 | } 27 | 28 | #if _runtime(_ObjC) 29 | var awaiter: Awaiter 30 | 31 | init() { 32 | awaiter = Awaiter( 33 | waitLock: AssertionWaitLock(), 34 | asyncQueue: dispatch_get_main_queue(), 35 | timeoutQueue: dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)) 36 | } 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Pods-LeeGo-Demo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## LeeGo 5 | 6 | Copyright (c) 2016 Victor Wang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | Generated by CocoaPods - http://cocoapods.org 27 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Pods-LeeGo-Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## LeeGo 5 | 6 | Copyright (c) 2016 Victor Wang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | Generated by CocoaPods - http://cocoapods.org 27 | -------------------------------------------------------------------------------- /Demo/LeeGo/ElementViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ElementViewModel.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 17/01/16. 6 | // Copyright © 2016 LeeGo. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import LeeGo 11 | 12 | struct ElementViewModel { 13 | 14 | let element: E 15 | 16 | init(element: E) { 17 | self.element = element 18 | } 19 | } 20 | 21 | extension ElementViewModel { 22 | static func elementViewModelsWithElements(elements: [E]) -> [ElementViewModel] { 23 | return elements.map({ (element) -> ElementViewModel in 24 | return ElementViewModel(element: element) 25 | }) 26 | } 27 | } 28 | 29 | extension ElementViewModel: BrickDataSource { 30 | func update(targetView: UIView, with brick: Brick) { 31 | switch targetView { 32 | case let titleLabel as UILabel where brick == LeMonde.title: 33 | titleLabel.attributedText = titleLabel.lg_updatedAttributedString(with: [element.isRestrict ? "󰀀" : nil, element.title, element.natureEdito]) 34 | case let subtitleLabel as UILabel where brick == LeMonde.subtitle: 35 | subtitleLabel.text = element.description 36 | case let illustration as UIImageView where brick == LeMonde.illustration: 37 | illustration.backgroundColor = UIColor.grayColor() 38 | default: 39 | break 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Demo/LeeGo/Element.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Element.swift 3 | // PlaygroundProject 4 | // 5 | // Created by Victor WANG on 14/11/15. 6 | // Copyright © 2015 Le Monde. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Element { 12 | 13 | let elementId: Int? 14 | let title: String? 15 | let natureEdito: String? 16 | let description: String? 17 | let date: String? 18 | let isRestrict: Bool 19 | let type: String? 20 | 21 | init?(dictionary: [String: AnyObject]) { 22 | self.elementId = dictionary["id"] as? Int 23 | self.title = dictionary["titre"] as? String 24 | self.natureEdito = dictionary["nature_edito"] as? String 25 | self.description = dictionary["description"] as? String 26 | self.date = dictionary["date_publication"] as? String 27 | self.isRestrict = (dictionary["restreint"] as? Bool) ?? false 28 | self.type = dictionary["type"] as? String 29 | 30 | if (self.elementId == nil || self.title == nil || self.description == nil || self.date == nil || self.type == nil) { 31 | return nil 32 | } 33 | } 34 | } 35 | 36 | extension Element { 37 | 38 | static func elementsFromDictionaries(dictionaries: [[String: AnyObject]]) -> [Element] { 39 | return dictionaries.flatMap({ (dictionary) -> Element? in 40 | return Element(dictionary: dictionary) 41 | }) 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/XCTestSuite+QuickTestSuiteBuilder.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @interface XCTestSuite (QuickTestSuiteBuilder) 6 | @end 7 | 8 | @implementation XCTestSuite (QuickTestSuiteBuilder) 9 | 10 | /** 11 | In order to ensure we can correctly build dynamic test suites, we need to 12 | replace some of the default test suite constructors. 13 | */ 14 | + (void)load { 15 | Method testCaseWithName = class_getClassMethod(self, @selector(testSuiteForTestCaseWithName:)); 16 | Method hooked_testCaseWithName = class_getClassMethod(self, @selector(qck_hooked_testSuiteForTestCaseWithName:)); 17 | method_exchangeImplementations(testCaseWithName, hooked_testCaseWithName); 18 | } 19 | 20 | /** 21 | The `+testSuiteForTestCaseWithName:` method is called when a specific test case 22 | class is run from the Xcode test navigator. If the built test suite is `nil`, 23 | Xcode will not run any tests for that test case. 24 | 25 | Given if the following test case class is run from the Xcode test navigator: 26 | 27 | FooSpec 28 | testFoo 29 | testBar 30 | 31 | XCTest will invoke this once per test case, with test case names following this format: 32 | 33 | FooSpec/testFoo 34 | FooSpec/testBar 35 | */ 36 | + (nullable instancetype)qck_hooked_testSuiteForTestCaseWithName:(nonnull NSString *)name { 37 | return [QuickTestSuite selectedTestSuiteForTestCaseWithName:name]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift: -------------------------------------------------------------------------------- 1 | /** 2 | A container for closures to be executed before and after each example. 3 | */ 4 | final internal class ExampleHooks { 5 | internal var befores: [BeforeExampleWithMetadataClosure] = [] 6 | internal var afters: [AfterExampleWithMetadataClosure] = [] 7 | internal var phase: HooksPhase = .NothingExecuted 8 | 9 | internal func appendBefore(closure: BeforeExampleWithMetadataClosure) { 10 | befores.append(closure) 11 | } 12 | 13 | internal func appendBefore(closure: BeforeExampleClosure) { 14 | befores.append { (exampleMetadata: ExampleMetadata) in closure() } 15 | } 16 | 17 | internal func appendAfter(closure: AfterExampleWithMetadataClosure) { 18 | afters.append(closure) 19 | } 20 | 21 | internal func appendAfter(closure: AfterExampleClosure) { 22 | afters.append { (exampleMetadata: ExampleMetadata) in closure() } 23 | } 24 | 25 | internal func executeBefores(exampleMetadata: ExampleMetadata) { 26 | phase = .BeforesExecuting 27 | for before in befores { 28 | before(exampleMetadata: exampleMetadata) 29 | } 30 | 31 | phase = .BeforesFinished 32 | } 33 | 34 | internal func executeAfters(exampleMetadata: ExampleMetadata) { 35 | phase = .AftersExecuting 36 | for after in afters { 37 | after(exampleMetadata: exampleMetadata) 38 | } 39 | 40 | phase = .AftersFinished 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | 4 | /// A Nimble matcher that succeeds when the actual value is the same instance 5 | /// as the expected instance. 6 | public func beIdenticalTo(expected: AnyObject?) -> NonNilMatcherFunc { 7 | return NonNilMatcherFunc { actualExpression, failureMessage in 8 | let actual = try actualExpression.evaluate() 9 | failureMessage.actualValue = "\(identityAsString(actual))" 10 | failureMessage.postfixMessage = "be identical to \(identityAsString(expected))" 11 | return actual === expected && actual !== nil 12 | } 13 | } 14 | 15 | public func ===(lhs: Expectation, rhs: AnyObject?) { 16 | lhs.to(beIdenticalTo(rhs)) 17 | } 18 | public func !==(lhs: Expectation, rhs: AnyObject?) { 19 | lhs.toNot(beIdenticalTo(rhs)) 20 | } 21 | 22 | /// A Nimble matcher that succeeds when the actual value is the same instance 23 | /// as the expected instance. 24 | /// 25 | /// Alias for "beIdenticalTo". 26 | public func be(expected: AnyObject?) -> NonNilMatcherFunc { 27 | return beIdenticalTo(expected) 28 | } 29 | 30 | #if _runtime(_ObjC) 31 | extension NMBObjCMatcher { 32 | public class func beIdenticalToMatcher(expected: NSObject?) -> NMBObjCMatcher { 33 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 34 | let aExpr = actualExpression.cast { $0 as AnyObject? } 35 | return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) 36 | } 37 | } 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /Sources/Cell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ReusableCell.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 10/01/16. 6 | // 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | // Cell 13 | 14 | extension UICollectionViewCell { 15 | 16 | /// Helper method used to calculate the fitting height of current cell. 17 | /// Call it directly inside UICollectionViewCell.preferredLayoutAttributesFittingAttributes. Ex: 18 | /// ``` 19 | /// override public func preferredLayoutAttributesFittingAttributes(layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { 20 | /// return lg_fittingHeightLayoutAttributes(layoutAttributes) 21 | /// } 22 | /// ``` 23 | /// 24 | /// - parameter layoutAttributes: layoutAttributes from `UICollectionViewCell.preferredLayoutAttributesFittingAttributes` 25 | /// 26 | /// - returns: UICollectionViewLayoutAttributes instance with fitting height. 27 | public func lg_fittingHeightLayoutAttributes(layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { 28 | self.frame = layoutAttributes.frame 29 | 30 | // TODO: implement a cache mechanisme 31 | // if cached, return cached value 32 | 33 | self.setNeedsLayout() 34 | self.layoutIfNeeded() 35 | 36 | layoutAttributes.frame = { 37 | var frame = layoutAttributes.frame 38 | frame.size.height = contentView.lg_fittingHeight() 39 | return frame 40 | }() 41 | 42 | // this function get called 4 times everytime 43 | return layoutAttributes 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Demo/Pods/Local Podspecs/LeeGo.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "LeeGo", 3 | "version": "0.4.1", 4 | "summary": "A Swift framework that helps you decouple & modularise your UI component into small pieces of LEGO style's bricks.", 5 | "description": "LeeGo is a Swift framework that helps you decouple & modularise your UI component into small pieces of LEGO style's bricks. Try to make iOS UI development declarative, configurable and highly reusable. LeeGo may help you with:\n* Describe your whole UI into small pieces of Lego style’s bricks. Let you configure your view as a `brick` whenever & wherever you want.\n* No longer need to deal with a bunch of custom UIView’s subclasses. Instead, you only need to deal with different `Brick`s which is lightweight and pure value type.\n* Designed to be UIKit friendly and non-intrusive. There is no need to inherit from other base class at all.\n* Capable to update remotely almost everything via your JSON payload.\n* Built-in convenience methods to make UIStackView like layout hassle-free.\n* Built-in **self-sizing mechanism** to calculate cell’s height automatically.\n* Benefits from Swift’s enum, let you put the whole UI in a single enum file.", 6 | "homepage": "https://github.com/wangshengjia/LeeGo", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "Victor Wang": "wangshengjia01@gmail.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/wangshengjia/LeeGo.git", 16 | "tag": "0.4.1" 17 | }, 18 | "social_media_url": "https://twitter.com/wangshengjia", 19 | "platforms": { 20 | "ios": "8.0" 21 | }, 22 | "requires_arc": true, 23 | "source_files": "Sources/**/*", 24 | "frameworks": "UIKit" 25 | } 26 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is less than the expected value. 4 | public func beLessThan(expectedValue: T?) -> NonNilMatcherFunc { 5 | return NonNilMatcherFunc { actualExpression, failureMessage in 6 | failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" 7 | return try actualExpression.evaluate() < expectedValue 8 | } 9 | } 10 | 11 | /// A Nimble matcher that succeeds when the actual value is less than the expected value. 12 | public func beLessThan(expectedValue: NMBComparable?) -> NonNilMatcherFunc { 13 | return NonNilMatcherFunc { actualExpression, failureMessage in 14 | failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" 15 | let actualValue = try actualExpression.evaluate() 16 | let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == NSComparisonResult.OrderedAscending 17 | return matches 18 | } 19 | } 20 | 21 | public func <(lhs: Expectation, rhs: T) { 22 | lhs.to(beLessThan(rhs)) 23 | } 24 | 25 | public func <(lhs: Expectation, rhs: NMBComparable?) { 26 | lhs.to(beLessThan(rhs)) 27 | } 28 | 29 | #if _runtime(_ObjC) 30 | extension NMBObjCMatcher { 31 | public class func beLessThanMatcher(expected: NMBComparable?) -> NMBObjCMatcher { 32 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 33 | let expr = actualExpression.cast { $0 as! NMBComparable? } 34 | return try! beLessThan(expected).matches(expr, failureMessage: failureMessage) 35 | } 36 | } 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/QuickTestSuite.swift: -------------------------------------------------------------------------------- 1 | #if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) 2 | 3 | import XCTest 4 | 5 | /** 6 | This protocol defines the role of an object that builds test suites. 7 | */ 8 | internal protocol QuickTestSuiteBuilder { 9 | 10 | /** 11 | Construct a `QuickTestSuite` instance with the appropriate test cases added as tests. 12 | 13 | Subsequent calls to this method should return equivalent test suites. 14 | */ 15 | func buildTestSuite() -> QuickTestSuite 16 | 17 | } 18 | 19 | /** 20 | A base class for a class cluster of Quick test suites, that should correctly 21 | build dynamic test suites for XCTest to execute. 22 | */ 23 | public class QuickTestSuite: XCTestSuite { 24 | 25 | private static var builtTestSuites: Set = Set() 26 | 27 | /** 28 | Construct a test suite for a specific, selected subset of test cases (rather 29 | than the default, which as all test cases). 30 | 31 | If this method is called multiple times for the same test case class, e.g.. 32 | 33 | FooSpec/testFoo 34 | FooSpec/testBar 35 | 36 | It is expected that the first call should return a valid test suite, and 37 | all subsequent calls should return `nil`. 38 | */ 39 | public static func selectedTestSuite(forTestCaseWithName name: String) -> QuickTestSuite? { 40 | guard let builder = QuickSelectedTestSuiteBuilder(forTestCaseWithName: name) else { return nil } 41 | 42 | if builtTestSuites.contains(builder.testSuiteClassName) { 43 | return nil 44 | } else { 45 | builtTestSuites.insert(builder.testSuiteClassName) 46 | return builder.buildTestSuite() 47 | } 48 | } 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | #if _runtime(_ObjC) 4 | 5 | // A Nimble matcher that catches attempts to use beAKindOf with non Objective-C types 6 | public func beAKindOf(expectedClass: Any) -> NonNilMatcherFunc { 7 | return NonNilMatcherFunc {actualExpression, failureMessage in 8 | failureMessage.stringValue = "beAKindOf only works on Objective-C types since" 9 | + " the Swift compiler will automatically type check Swift-only types." 10 | + " This expectation is redundant." 11 | return false 12 | } 13 | } 14 | 15 | /// A Nimble matcher that succeeds when the actual value is an instance of the given class. 16 | /// @see beAnInstanceOf if you want to match against the exact class 17 | public func beAKindOf(expectedClass: AnyClass) -> NonNilMatcherFunc { 18 | return NonNilMatcherFunc { actualExpression, failureMessage in 19 | let instance = try actualExpression.evaluate() 20 | if let validInstance = instance { 21 | failureMessage.actualValue = "<\(classAsString(validInstance.dynamicType)) instance>" 22 | } else { 23 | failureMessage.actualValue = "" 24 | } 25 | failureMessage.postfixMessage = "be a kind of \(classAsString(expectedClass))" 26 | return instance != nil && instance!.isKindOfClass(expectedClass) 27 | } 28 | } 29 | 30 | extension NMBObjCMatcher { 31 | public class func beAKindOfMatcher(expected: AnyClass) -> NMBMatcher { 32 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 33 | return try! beAKindOf(expected).matches(actualExpression, failureMessage: failureMessage) 34 | } 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | 4 | /// A Nimble matcher that succeeds when the actual value is greater than the expected value. 5 | public func beGreaterThan(expectedValue: T?) -> NonNilMatcherFunc { 6 | return NonNilMatcherFunc { actualExpression, failureMessage in 7 | failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" 8 | return try actualExpression.evaluate() > expectedValue 9 | } 10 | } 11 | 12 | /// A Nimble matcher that succeeds when the actual value is greater than the expected value. 13 | public func beGreaterThan(expectedValue: NMBComparable?) -> NonNilMatcherFunc { 14 | return NonNilMatcherFunc { actualExpression, failureMessage in 15 | failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" 16 | let actualValue = try actualExpression.evaluate() 17 | let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == NSComparisonResult.OrderedDescending 18 | return matches 19 | } 20 | } 21 | 22 | public func >(lhs: Expectation, rhs: T) { 23 | lhs.to(beGreaterThan(rhs)) 24 | } 25 | 26 | public func >(lhs: Expectation, rhs: NMBComparable?) { 27 | lhs.to(beGreaterThan(rhs)) 28 | } 29 | 30 | #if _runtime(_ObjC) 31 | extension NMBObjCMatcher { 32 | public class func beGreaterThanMatcher(expected: NMBComparable?) -> NMBObjCMatcher { 33 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 34 | let expr = actualExpression.cast { $0 as? NMBComparable } 35 | return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage) 36 | } 37 | } 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is less than 4 | /// or equal to the expected value. 5 | public func beLessThanOrEqualTo(expectedValue: T?) -> NonNilMatcherFunc { 6 | return NonNilMatcherFunc { actualExpression, failureMessage in 7 | failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" 8 | return try actualExpression.evaluate() <= expectedValue 9 | } 10 | } 11 | 12 | /// A Nimble matcher that succeeds when the actual value is less than 13 | /// or equal to the expected value. 14 | public func beLessThanOrEqualTo(expectedValue: T?) -> NonNilMatcherFunc { 15 | return NonNilMatcherFunc { actualExpression, failureMessage in 16 | failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" 17 | let actualValue = try actualExpression.evaluate() 18 | return actualValue != nil && actualValue!.NMB_compare(expectedValue) != NSComparisonResult.OrderedDescending 19 | } 20 | } 21 | 22 | public func <=(lhs: Expectation, rhs: T) { 23 | lhs.to(beLessThanOrEqualTo(rhs)) 24 | } 25 | 26 | public func <=(lhs: Expectation, rhs: T) { 27 | lhs.to(beLessThanOrEqualTo(rhs)) 28 | } 29 | 30 | #if _runtime(_ObjC) 31 | extension NMBObjCMatcher { 32 | public class func beLessThanOrEqualToMatcher(expected: NMBComparable?) -> NMBObjCMatcher { 33 | return NMBObjCMatcher(canMatchNil:false) { actualExpression, failureMessage in 34 | let expr = actualExpression.cast { $0 as? NMBComparable } 35 | return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) 36 | } 37 | } 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/NSString+QCKSelectorName.m: -------------------------------------------------------------------------------- 1 | #import "NSString+QCKSelectorName.h" 2 | 3 | @implementation NSString (QCKSelectorName) 4 | 5 | - (NSString *)qck_selectorName { 6 | static NSMutableCharacterSet *invalidCharacters = nil; 7 | static dispatch_once_t onceToken; 8 | dispatch_once(&onceToken, ^{ 9 | invalidCharacters = [NSMutableCharacterSet new]; 10 | 11 | NSCharacterSet *whitespaceCharacterSet = [NSCharacterSet whitespaceCharacterSet]; 12 | NSCharacterSet *newlineCharacterSet = [NSCharacterSet newlineCharacterSet]; 13 | NSCharacterSet *illegalCharacterSet = [NSCharacterSet illegalCharacterSet]; 14 | NSCharacterSet *controlCharacterSet = [NSCharacterSet controlCharacterSet]; 15 | NSCharacterSet *punctuationCharacterSet = [NSCharacterSet punctuationCharacterSet]; 16 | NSCharacterSet *nonBaseCharacterSet = [NSCharacterSet nonBaseCharacterSet]; 17 | NSCharacterSet *symbolCharacterSet = [NSCharacterSet symbolCharacterSet]; 18 | 19 | [invalidCharacters formUnionWithCharacterSet:whitespaceCharacterSet]; 20 | [invalidCharacters formUnionWithCharacterSet:newlineCharacterSet]; 21 | [invalidCharacters formUnionWithCharacterSet:illegalCharacterSet]; 22 | [invalidCharacters formUnionWithCharacterSet:controlCharacterSet]; 23 | [invalidCharacters formUnionWithCharacterSet:punctuationCharacterSet]; 24 | [invalidCharacters formUnionWithCharacterSet:nonBaseCharacterSet]; 25 | [invalidCharacters formUnionWithCharacterSet:symbolCharacterSet]; 26 | }); 27 | 28 | NSArray *validComponents = [self componentsSeparatedByCharactersInSet:invalidCharacters]; 29 | 30 | NSString *result = [validComponents componentsJoinedByString:@"_"]; 31 | 32 | return ([result length] == 0 33 | ? @"_" 34 | : result); 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // A Nimble matcher that catches attempts to use beAnInstanceOf with non Objective-C types 4 | public func beAnInstanceOf(expectedClass: Any) -> NonNilMatcherFunc { 5 | return NonNilMatcherFunc {actualExpression, failureMessage in 6 | failureMessage.stringValue = "beAnInstanceOf only works on Objective-C types since" 7 | + " the Swift compiler will automatically type check Swift-only types." 8 | + " This expectation is redundant." 9 | return false 10 | } 11 | } 12 | 13 | /// A Nimble matcher that succeeds when the actual value is an instance of the given class. 14 | /// @see beAKindOf if you want to match against subclasses 15 | public func beAnInstanceOf(expectedClass: AnyClass) -> NonNilMatcherFunc { 16 | return NonNilMatcherFunc { actualExpression, failureMessage in 17 | let instance = try actualExpression.evaluate() 18 | if let validInstance = instance { 19 | failureMessage.actualValue = "<\(classAsString(validInstance.dynamicType)) instance>" 20 | } else { 21 | failureMessage.actualValue = "" 22 | } 23 | failureMessage.postfixMessage = "be an instance of \(classAsString(expectedClass))" 24 | #if _runtime(_ObjC) 25 | return instance != nil && instance!.isMemberOfClass(expectedClass) 26 | #else 27 | return instance != nil && instance!.dynamicType == expectedClass 28 | #endif 29 | } 30 | } 31 | 32 | #if _runtime(_ObjC) 33 | extension NMBObjCMatcher { 34 | public class func beAnInstanceOfMatcher(expected: AnyClass) -> NMBMatcher { 35 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 36 | return try! beAnInstanceOf(expected).matches(actualExpression, failureMessage: failureMessage) 37 | } 38 | } 39 | } 40 | #endif 41 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is greater than 4 | /// or equal to the expected value. 5 | public func beGreaterThanOrEqualTo(expectedValue: T?) -> NonNilMatcherFunc { 6 | return NonNilMatcherFunc { actualExpression, failureMessage in 7 | failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" 8 | let actualValue = try actualExpression.evaluate() 9 | return actualValue >= expectedValue 10 | } 11 | } 12 | 13 | /// A Nimble matcher that succeeds when the actual value is greater than 14 | /// or equal to the expected value. 15 | public func beGreaterThanOrEqualTo(expectedValue: T?) -> NonNilMatcherFunc { 16 | return NonNilMatcherFunc { actualExpression, failureMessage in 17 | failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" 18 | let actualValue = try actualExpression.evaluate() 19 | let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != NSComparisonResult.OrderedAscending 20 | return matches 21 | } 22 | } 23 | 24 | public func >=(lhs: Expectation, rhs: T) { 25 | lhs.to(beGreaterThanOrEqualTo(rhs)) 26 | } 27 | 28 | public func >=(lhs: Expectation, rhs: T) { 29 | lhs.to(beGreaterThanOrEqualTo(rhs)) 30 | } 31 | 32 | #if _runtime(_ObjC) 33 | extension NMBObjCMatcher { 34 | public class func beGreaterThanOrEqualToMatcher(expected: NMBComparable?) -> NMBObjCMatcher { 35 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 36 | let expr = actualExpression.cast { $0 as? NMBComparable } 37 | return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) 38 | } 39 | } 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /Demo/LeeGo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UIAppFonts 31 | 32 | FetteEngschrift.otf 33 | LmfrAppIcon.ttf 34 | TheSansOsF-SemiLight.otf 35 | TheSansOsF-SemiBold.otf 36 | TheSansOsF-Plain.otf 37 | TheSansOsF-Bold.otf 38 | TheAntiquaB-W5PlainItalic.otf 39 | TheAntiquaB-W5Plain.otf 40 | TheAntiquaB-W6SemiBold.otf 41 | TheAntiquaB-W8ExtraBold.otf 42 | TheAntiquaB-W7Bold.otf 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIMainStoryboardFile 47 | Main 48 | UIRequiredDeviceCapabilities 49 | 50 | armv7 51 | 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/FailureMessage.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Encapsulates the failure message that matchers can report to the end user. 4 | /// 5 | /// This is shared state between Nimble and matchers that mutate this value. 6 | public class FailureMessage: NSObject { 7 | public var expected: String = "expected" 8 | public var actualValue: String? = "" // empty string -> use default; nil -> exclude 9 | public var to: String = "to" 10 | public var postfixMessage: String = "match" 11 | public var postfixActual: String = "" 12 | public var userDescription: String? = nil 13 | 14 | public var stringValue: String { 15 | get { 16 | if let value = _stringValueOverride { 17 | return value 18 | } else { 19 | return computeStringValue() 20 | } 21 | } 22 | set { 23 | _stringValueOverride = newValue 24 | } 25 | } 26 | 27 | internal var _stringValueOverride: String? 28 | 29 | public override init() { 30 | } 31 | 32 | public init(stringValue: String) { 33 | _stringValueOverride = stringValue 34 | } 35 | 36 | internal func stripNewlines(str: String) -> String { 37 | var lines: [String] = NSString(string: str).componentsSeparatedByString("\n") as [String] 38 | let whitespace = NSCharacterSet.whitespaceAndNewlineCharacterSet() 39 | lines = lines.map { line in NSString(string: line).stringByTrimmingCharactersInSet(whitespace) } 40 | return lines.joinWithSeparator("") 41 | } 42 | 43 | internal func computeStringValue() -> String { 44 | var value = "\(expected) \(to) \(postfixMessage)" 45 | if let actualValue = actualValue { 46 | value = "\(expected) \(to) \(postfixMessage), got \(actualValue)\(postfixActual)" 47 | } 48 | value = stripNewlines(value) 49 | 50 | if let userDescription = userDescription { 51 | return "\(userDescription)\n\(value)" 52 | } 53 | 54 | return value 55 | } 56 | } -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/DSL/World+DSL.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface World (SWIFT_EXTENSION(Quick)) 4 | - (void)beforeSuite:(void (^ __nonnull)(void))closure; 5 | - (void)afterSuite:(void (^ __nonnull)(void))closure; 6 | - (void)sharedExamples:(NSString * __nonnull)name closure:(void (^ __nonnull)(NSDictionary * __nonnull (^ __nonnull)(void)))closure; 7 | - (void)describe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; 8 | - (void)context:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; 9 | - (void)fdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; 10 | - (void)xdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; 11 | - (void)beforeEach:(void (^ __nonnull)(void))closure; 12 | - (void)beforeEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; 13 | - (void)afterEach:(void (^ __nonnull)(void))closure; 14 | - (void)afterEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; 15 | - (void)itWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; 16 | - (void)fitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; 17 | - (void)xitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; 18 | - (void)itBehavesLikeSharedExampleNamed:(NSString * __nonnull)name sharedExampleContext:(NSDictionary * __nonnull (^ __nonnull)(void))sharedExampleContext flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line; 19 | - (void)pending:(NSString * __nonnull)description closure:(void (^ __nonnull)(void))closure; 20 | @end 21 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/QuickSpec.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | QuickSpec is a base class all specs written in Quick inherit from. 5 | They need to inherit from QuickSpec, a subclass of XCTestCase, in 6 | order to be discovered by the XCTest framework. 7 | 8 | XCTest automatically compiles a list of XCTestCase subclasses included 9 | in the test target. It iterates over each class in that list, and creates 10 | a new instance of that class for each test method. It then creates an 11 | "invocation" to execute that test method. The invocation is an instance of 12 | NSInvocation, which represents a single message send in Objective-C. 13 | The invocation is set on the XCTestCase instance, and the test is run. 14 | 15 | Most of the code in QuickSpec is dedicated to hooking into XCTest events. 16 | First, when the spec is first loaded and before it is sent any messages, 17 | the +[NSObject initialize] method is called. QuickSpec overrides this method 18 | to call +[QuickSpec spec]. This builds the example group stacks and 19 | registers them with Quick.World, a global register of examples. 20 | 21 | Then, XCTest queries QuickSpec for a list of test methods. Normally, XCTest 22 | automatically finds all methods whose selectors begin with the string "test". 23 | However, QuickSpec overrides this default behavior by implementing the 24 | +[XCTestCase testInvocations] method. This method iterates over each example 25 | registered in Quick.World, defines a new method for that example, and 26 | returns an invocation to call that method to XCTest. Those invocations are 27 | the tests that are run by XCTest. Their selector names are displayed in 28 | the Xcode test navigation bar. 29 | */ 30 | @interface QuickSpec : XCTestCase 31 | 32 | /** 33 | Override this method in your spec to define a set of example groups 34 | and examples. 35 | 36 | override class func spec() { 37 | describe("winter") { 38 | it("is coming") { 39 | // ... 40 | } 41 | } 42 | } 43 | 44 | See DSL.swift for more information on what syntax is available. 45 | */ 46 | - (void)spec; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pods/Quick/README.md: -------------------------------------------------------------------------------- 1 | ![](http://f.cl.ly/items/0r1E192C1R0b2g2Q3h2w/QuickLogo_Color.png) 2 | 3 | Quick is a behavior-driven development framework for Swift and Objective-C. 4 | Inspired by [RSpec](https://github.com/rspec/rspec), [Specta](https://github.com/specta/specta), and [Ginkgo](https://github.com/onsi/ginkgo). 5 | 6 | ![](https://raw.githubusercontent.com/Quick/Assets/master/Screenshots/QuickSpec%20screenshot.png) 7 | 8 | ```swift 9 | // Swift 10 | 11 | import Quick 12 | import Nimble 13 | 14 | class TableOfContentsSpec: QuickSpec { 15 | override func spec() { 16 | describe("the 'Documentation' directory") { 17 | it("has everything you need to get started") { 18 | let sections = Directory("Documentation").sections 19 | expect(sections).to(contain("Organized Tests with Quick Examples and Example Groups")) 20 | expect(sections).to(contain("Installing Quick")) 21 | } 22 | 23 | context("if it doesn't have what you're looking for") { 24 | it("needs to be updated") { 25 | let you = You(awesome: true) 26 | expect{you.submittedAnIssue}.toEventually(beTruthy()) 27 | } 28 | } 29 | } 30 | } 31 | } 32 | ``` 33 | #### Nimble 34 | Quick comes together with [Nimble](https://github.com/Quick/Nimble) — a matcher framework for your tests. You can learn why `XCTAssert()` statements make your expectations unclear and how to fix that using Nimble assertions [here](./Documentation/NimbleAssertions.md). 35 | 36 | ## Documentation 37 | 38 | All documentation can be found in the [Documentation folder](./Documentation), including [detailed installation instructions](./Documentation/InstallingQuick.md) for CocoaPods, Carthage, Git submodules, and more. For example, you can install Quick and [Nimble](https://github.com/Quick/Nimble) using CocoaPods by adding the following to your Podfile: 39 | 40 | ```rb 41 | # Podfile 42 | 43 | use_frameworks! 44 | 45 | def testing_pods 46 | pod 'Quick', '~> 0.9.0' 47 | pod 'Nimble', '3.0.0' 48 | end 49 | 50 | target 'MyTests' do 51 | testing_pods 52 | end 53 | 54 | target 'MyUITests' do 55 | testing_pods 56 | end 57 | ``` 58 | 59 | ## License 60 | 61 | Apache 2.0 license. See the `LICENSE` file for details. 62 | -------------------------------------------------------------------------------- /Demo/LeeGo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // LeeGo 4 | // 5 | // Created by Victor Wang on 01/08/2016. 6 | // Copyright (c) 2016 Victor Wang. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Pods-LeeGo-Demo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2016 Victor Wang <wangshengjia01@gmail.com> 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | Title 38 | LeeGo 39 | Type 40 | PSGroupSpecifier 41 | 42 | 43 | FooterText 44 | Generated by CocoaPods - http://cocoapods.org 45 | Title 46 | 47 | Type 48 | PSGroupSpecifier 49 | 50 | 51 | StringsTable 52 | Acknowledgements 53 | Title 54 | Acknowledgements 55 | 56 | 57 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Pods-LeeGo-Tests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2016 Victor Wang <wangshengjia01@gmail.com> 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | Title 38 | LeeGo 39 | Type 40 | PSGroupSpecifier 41 | 42 | 43 | FooterText 44 | Generated by CocoaPods - http://cocoapods.org 45 | Title 46 | 47 | Type 48 | PSGroupSpecifier 49 | 50 | 51 | StringsTable 52 | Acknowledgements 53 | Title 54 | Acknowledgements 55 | 56 | 57 | -------------------------------------------------------------------------------- /Demo/Pods/Pods.xcodeproj/xcshareddata/xcschemes/LeeGo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual CollectionType's count equals 4 | /// the expected value 5 | public func haveCount(expectedValue: T.Index.Distance) -> NonNilMatcherFunc { 6 | return NonNilMatcherFunc { actualExpression, failureMessage in 7 | if let actualValue = try actualExpression.evaluate() { 8 | failureMessage.postfixMessage = "have \(actualValue) with count \(expectedValue)" 9 | let result = expectedValue == actualValue.count 10 | failureMessage.actualValue = "\(actualValue.count)" 11 | return result 12 | } else { 13 | return false 14 | } 15 | } 16 | } 17 | 18 | /// A Nimble matcher that succeeds when the actual collection's count equals 19 | /// the expected value 20 | public func haveCount(expectedValue: Int) -> MatcherFunc { 21 | return MatcherFunc { actualExpression, failureMessage in 22 | if let actualValue = try actualExpression.evaluate() { 23 | failureMessage.postfixMessage = "have \(actualValue) with count \(expectedValue)" 24 | let result = expectedValue == actualValue.count 25 | failureMessage.actualValue = "\(actualValue.count)" 26 | return result 27 | } else { 28 | return false 29 | } 30 | } 31 | } 32 | 33 | #if _runtime(_ObjC) 34 | extension NMBObjCMatcher { 35 | public class func haveCountMatcher(expected: NSNumber) -> NMBObjCMatcher { 36 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 37 | let location = actualExpression.location 38 | let actualValue = try! actualExpression.evaluate() 39 | if let value = actualValue as? NMBCollection { 40 | let expr = Expression(expression: ({ value as NMBCollection}), location: location) 41 | return try! haveCount(expected.integerValue).matches(expr, failureMessage: failureMessage) 42 | } else if let actualValue = actualValue { 43 | failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" 44 | failureMessage.actualValue = "\(classAsString(actualValue.dynamicType))" 45 | } 46 | return false 47 | } 48 | } 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Utils/Stringers.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | 4 | internal func identityAsString(value: AnyObject?) -> String { 5 | if let value = value { 6 | return NSString(format: "<%p>", unsafeBitCast(value, Int.self)).description 7 | } else { 8 | return "nil" 9 | } 10 | } 11 | 12 | internal func classAsString(cls: AnyClass) -> String { 13 | #if _runtime(_ObjC) 14 | return NSStringFromClass(cls) 15 | #else 16 | return String(cls) 17 | #endif 18 | } 19 | 20 | internal func arrayAsString(items: [T], joiner: String = ", ") -> String { 21 | return items.reduce("") { accum, item in 22 | let prefix = (accum.isEmpty ? "" : joiner) 23 | return accum + prefix + "\(stringify(item))" 24 | } 25 | } 26 | 27 | #if _runtime(_ObjC) 28 | @objc internal protocol NMBStringer { 29 | func NMB_stringify() -> String 30 | } 31 | 32 | extension NSArray : NMBStringer { 33 | func NMB_stringify() -> String { 34 | let str = self.componentsJoinedByString(", ") 35 | return "[\(str)]" 36 | } 37 | } 38 | #endif 39 | 40 | internal func stringify(value: S) -> String { 41 | var generator = value.generate() 42 | var strings = [String]() 43 | var value: S.Generator.Element? 44 | repeat { 45 | value = generator.next() 46 | if value != nil { 47 | strings.append(stringify(value)) 48 | } 49 | } while value != nil 50 | let str = strings.joinWithSeparator(", ") 51 | return "[\(str)]" 52 | } 53 | 54 | internal func stringify(value: T) -> String { 55 | if let value = value as? Double { 56 | return NSString(format: "%.4f", (value)).description 57 | } else if let value = value as? NSData { 58 | #if os(Linux) 59 | // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) 60 | return "NSData" 61 | #else 62 | return "NSData" 63 | #endif 64 | } 65 | return String(value) 66 | } 67 | 68 | internal func stringify(value: NMBDoubleConvertible) -> String { 69 | if let value = value as? Double { 70 | return NSString(format: "%.4f", (value)).description 71 | } 72 | return value.stringRepresentation 73 | } 74 | 75 | internal func stringify(value: T?) -> String { 76 | if let unboxed = value { 77 | return stringify(unboxed) 78 | } 79 | return "nil" 80 | } 81 | -------------------------------------------------------------------------------- /LeeGo.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint LeeGo.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "LeeGo" 11 | s.version = "0.5.2" 12 | s.summary = "A Swift framework that helps you decouple & modularise your UI component into small pieces of LEGO style's bricks." 13 | 14 | s.description = <<-DESC 15 | LeeGo is a Swift framework that helps you decouple & modularise your UI component into small pieces of LEGO style's bricks. Try to make iOS UI development declarative, configurable and highly reusable. LeeGo may help you with: 16 | * Describe your whole UI into small pieces of Lego style’s bricks. Let you configure your view as a `brick` whenever & wherever you want. 17 | * No longer need to deal with a bunch of custom UIView’s subclasses. Instead, you only need to deal with different `Brick`s which is lightweight and pure value type. 18 | * Designed to be UIKit friendly and non-intrusive. There is no need to inherit from other base class at all. 19 | * Capable to update remotely almost everything via your JSON payload. 20 | * Built-in convenience methods to make UIStackView like layout hassle-free. 21 | * Built-in **self-sizing mechanism** to calculate cell’s height automatically. 22 | * Benefits from Swift’s enum, let you put the whole UI in a single enum file. 23 | DESC 24 | 25 | s.homepage = "https://github.com/wangshengjia/LeeGo" 26 | s.screenshots = "https://raw.githubusercontent.com/wangshengjia/LeeGo/master/Medias/leego.jpg" 27 | 28 | s.license = { :type => "MIT", :file => "LICENSE" } 29 | 30 | s.author = { "Victor Wang" => "wangshengjia01@gmail.com" } 31 | s.source = { :git => "https://github.com/wangshengjia/LeeGo.git", :tag => s.version.to_s } 32 | 33 | s.social_media_url = 'https://twitter.com/wangshengjia' 34 | 35 | s.platform = :ios, '8.0' 36 | s.requires_arc = true 37 | 38 | s.source_files = 'Sources/**/*' 39 | 40 | # s.public_header_files = 'Sources/**/*.h' 41 | 42 | s.frameworks = 'UIKit' 43 | 44 | end 45 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift: -------------------------------------------------------------------------------- 1 | #if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) 2 | 3 | /** 4 | Responsible for building a "Selected tests" suite. This corresponds to a single 5 | spec, and all its examples. 6 | */ 7 | internal class QuickSelectedTestSuiteBuilder: QuickTestSuiteBuilder { 8 | 9 | /** 10 | The test spec class to run. 11 | */ 12 | let testCaseClass: AnyClass! 13 | 14 | /** 15 | For Objective-C classes, returns the class name. For Swift classes without, 16 | an explicit Objective-C name, returns a module-namespaced class name 17 | (e.g., "FooTests.FooSpec"). 18 | */ 19 | var testSuiteClassName: String { 20 | return NSStringFromClass(testCaseClass) 21 | } 22 | 23 | /** 24 | Given a test case name: 25 | 26 | FooSpec/testFoo 27 | 28 | Optionally constructs a test suite builder for the named test case class 29 | in the running test bundle. 30 | 31 | If no test bundle can be found, or the test case class can't be found, 32 | initialization fails and returns `nil`. 33 | */ 34 | init?(forTestCaseWithName name: String) { 35 | guard let testCaseClass = testCaseClassForTestCaseWithName(name) else { 36 | self.testCaseClass = nil 37 | return nil 38 | } 39 | 40 | self.testCaseClass = testCaseClass 41 | } 42 | 43 | /** 44 | Returns a `QuickTestSuite` that runs the associated test case class. 45 | */ 46 | func buildTestSuite() -> QuickTestSuite { 47 | return QuickTestSuite(forTestCaseClass: testCaseClass) 48 | } 49 | 50 | } 51 | 52 | /** 53 | Searches `NSBundle.allBundles()` for an xctest bundle, then looks up the named 54 | test case class in that bundle. 55 | 56 | Returns `nil` if a bundle or test case class cannot be found. 57 | */ 58 | private func testCaseClassForTestCaseWithName(name: String) -> AnyClass? { 59 | func extractClassName(name: String) -> String? { 60 | return name.characters.split("/").first.map(String.init) 61 | } 62 | 63 | guard let className = extractClassName(name) else { return nil } 64 | guard let bundle = NSBundle.currentTestBundle else { return nil } 65 | 66 | if let testCaseClass = bundle.classNamed(className) { return testCaseClass } 67 | 68 | guard let moduleName = bundle.bundlePath.fileName else { return nil } 69 | 70 | return NSClassFromString("\(moduleName).\(className)") 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /Sources/Constraint.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Constraint.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 19/03/16. 6 | // 7 | // 8 | 9 | import Foundation 10 | 11 | extension NSLayoutConstraint { 12 | internal enum Mode { 13 | case Dimension, SubviewsLayout, Ratio, Unknown 14 | } 15 | 16 | internal func lg_setIdentifier(with type: Mode) { 17 | switch type { 18 | case .Dimension: 19 | self.identifier = "LG_Dimension: \(self.description)" 20 | case .SubviewsLayout: 21 | self.identifier = "LG_SubviewsLayout: \(self.description)" 22 | case .Ratio: 23 | self.identifier = "LG_Ratio: \(self.description)" 24 | default: 25 | return 26 | } 27 | } 28 | 29 | internal var mode: Mode { 30 | if self.identifier?.hasPrefix("LG_Dimension") ?? false { 31 | return .Dimension 32 | } else if self.identifier?.hasPrefix("LG_SubviewsLayout") ?? false { 33 | return .SubviewsLayout 34 | } else if self.identifier?.hasPrefix("LG_Ratio") ?? false { 35 | return .Ratio 36 | } else { 37 | return .Unknown 38 | } 39 | } 40 | } 41 | 42 | extension UIView { 43 | 44 | internal func lg_constraint(type: NSLayoutAttribute) -> NSLayoutConstraint? { 45 | switch type { 46 | case .Width, .Height: 47 | for constraint in self.constraints where constraint.firstAttribute == type 48 | && constraint.mode == .Dimension 49 | && constraint.firstItem === self 50 | && constraint.secondItem === nil { 51 | return constraint 52 | } 53 | default: 54 | break 55 | } 56 | 57 | return nil 58 | } 59 | 60 | internal func lg_applyConstraint(type: NSLayoutAttribute, constant: CGFloat) { 61 | if let constraint = self.lg_constraint(type) { 62 | constraint.constant = constant 63 | } else { 64 | let constraint = NSLayoutConstraint(item: self, attribute: type, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: constant) 65 | constraint.lg_setIdentifier(with: .Dimension) 66 | self.addConstraint(constraint) 67 | } 68 | } 69 | 70 | internal func unapplyConstraint(type: NSLayoutAttribute) { 71 | if let constraint = self.lg_constraint(type) { 72 | self.removeConstraint(constraint) 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /Demo/LeeGo/MainViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // PlaygroundProject 4 | // 5 | // Created by Victor WANG on 12/11/15. 6 | // Copyright © 2015 Le Monde. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import LeeGo 11 | 12 | class MainViewController: UITableViewController { 13 | 14 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 15 | return 4 16 | } 17 | 18 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 19 | let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) 20 | 21 | switch indexPath.row { 22 | case 0: 23 | cell.textLabel?.text = "Layout Samples" 24 | case 1: 25 | cell.textLabel?.text = "Le Monde" 26 | case 2: 27 | cell.textLabel?.text = "Twitter" 28 | case 3: 29 | cell.textLabel?.text = "Details Page" 30 | default: 31 | break 32 | } 33 | 34 | return cell 35 | } 36 | 37 | override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 38 | tableView.deselectRowAtIndexPath(indexPath, animated: true) 39 | 40 | switch indexPath.row { 41 | case 0: 42 | if let viewController = self.storyboard?.instantiateViewControllerWithIdentifier("SamplesViewController") as? SamplesViewController { 43 | self.navigationController?.pushViewController(viewController, animated: true) 44 | } 45 | case 1: 46 | if let viewController = self.storyboard?.instantiateViewControllerWithIdentifier("LeMondeNewsFeedViewController") as? LeMondeNewsFeedViewController { 47 | self.navigationController?.pushViewController(viewController, animated: true) 48 | } 49 | case 2: 50 | if let viewController = self.storyboard?.instantiateViewControllerWithIdentifier("TwitterFeedViewController") as? TwitterFeedViewController { 51 | self.navigationController?.pushViewController(viewController, animated: true) 52 | } 53 | case 3: 54 | if let viewController = self.storyboard?.instantiateViewControllerWithIdentifier("DetailsViewController") as? DetailsViewController { 55 | self.navigationController?.pushViewController(viewController, animated: true) 56 | } 57 | default: 58 | break 59 | } 60 | } 61 | } 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | 4 | /// A Nimble matcher that succeeds when the actual sequence's first element 5 | /// is equal to the expected value. 6 | public func beginWith(startingElement: T) -> NonNilMatcherFunc { 7 | return NonNilMatcherFunc { actualExpression, failureMessage in 8 | failureMessage.postfixMessage = "begin with <\(startingElement)>" 9 | if let actualValue = try actualExpression.evaluate() { 10 | var actualGenerator = actualValue.generate() 11 | return actualGenerator.next() == startingElement 12 | } 13 | return false 14 | } 15 | } 16 | 17 | /// A Nimble matcher that succeeds when the actual collection's first element 18 | /// is equal to the expected object. 19 | public func beginWith(startingElement: AnyObject) -> NonNilMatcherFunc { 20 | return NonNilMatcherFunc { actualExpression, failureMessage in 21 | failureMessage.postfixMessage = "begin with <\(startingElement)>" 22 | let collection = try actualExpression.evaluate() 23 | return collection != nil && collection!.indexOfObject(startingElement) == 0 24 | } 25 | } 26 | 27 | /// A Nimble matcher that succeeds when the actual string contains expected substring 28 | /// where the expected substring's location is zero. 29 | public func beginWith(startingSubstring: String) -> NonNilMatcherFunc { 30 | return NonNilMatcherFunc { actualExpression, failureMessage in 31 | failureMessage.postfixMessage = "begin with <\(startingSubstring)>" 32 | if let actual = try actualExpression.evaluate() { 33 | let range = actual.rangeOfString(startingSubstring) 34 | return range != nil && range!.startIndex == actual.startIndex 35 | } 36 | return false 37 | } 38 | } 39 | 40 | #if _runtime(_ObjC) 41 | extension NMBObjCMatcher { 42 | public class func beginWithMatcher(expected: AnyObject) -> NMBObjCMatcher { 43 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 44 | let actual = try! actualExpression.evaluate() 45 | if let _ = actual as? String { 46 | let expr = actualExpression.cast { $0 as? String } 47 | return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage) 48 | } else { 49 | let expr = actualExpression.cast { $0 as? NMBOrderedCollection } 50 | return try! beginWith(expected).matches(expr, failureMessage: failureMessage) 51 | } 52 | } 53 | } 54 | } 55 | #endif 56 | -------------------------------------------------------------------------------- /Demo/LeeGo/DetailsViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DetailsViewController.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 24/04/16. 6 | // Copyright © 2016 LeeGo. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | import LeeGo 13 | 14 | class DetailsViewController: UIViewController { 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | setup() 20 | } 21 | } 22 | 23 | extension DetailsViewController { 24 | 25 | private func setup() { 26 | let title = "title".build(UILabel).style([.numberOfLines(0), .text("Lorem Ipsum is simply dummy text of the printing industry")]) 27 | let description = "description".build(UILabel).style([.textColor(UIColor.lightGrayColor()), .numberOfLines(0), .font(UIFont.systemFontOfSize(14)), .text("Lorem Ipsum has been the industry's standard dummy text ever since the 1500s")]) 28 | let redBlock = "red".build().style(Style.redBlockStyle) 29 | let greenBlock = "green".build().style(Style.greenBlockStyle) 30 | let blueBlock = "blue".build(UIImageView).style(Style.blueBlockStyle + [.custom(["shadowColor": UIColor.brownColor(), "shadowOpacity": 1.0])]) 31 | 32 | let blocks = Brick.union("blocks", bricks: [ 33 | redBlock.height(50), 34 | greenBlock.height(80), 35 | blueBlock.height(30)], 36 | axis: .Horizontal, align: .Top, distribution: .FillEqually, metrics: LayoutMetrics(10, 10, 10, 10, 10, 10)).style(Style.blocksStyle) 37 | 38 | let brick = "details".build().bricks(title, description, blocks) { 39 | title, description, blocks in 40 | Layout(bricks: [title, description, blocks], axis: .Vertical, align: .Fill, distribution: .Flow(3), metrics: LayoutMetrics(84, 20, 20, 20, 10, 10)) 41 | } 42 | 43 | self.view.lg_configureAs(brick, updatingStrategy: .Always) 44 | } 45 | } 46 | 47 | extension UIView { 48 | public func lg_setupCustomStyle(style: [String: AnyObject]) { 49 | if let view = self as? UIImageView, 50 | let color = style["shadowColor"] as? UIColor, 51 | let opacity = style["shadowOpacity"] as? Float { 52 | view.layer.shadowColor = color.CGColor 53 | view.layer.shadowOpacity = opacity 54 | } 55 | } 56 | 57 | public func lg_removeCustomStyle(style: [String: AnyObject]) { 58 | if let view = self as? UIImageView, 59 | let _ = style["shadowColor"] as? UIColor, 60 | let _ = style["shadowOpacity"] as? Float { 61 | view.layer.shadowColor = UIColor.blackColor().CGColor 62 | view.layer.shadowOpacity = 0.0 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | internal class NotificationCollector { 4 | private(set) var observedNotifications: [NSNotification] 5 | private let notificationCenter: NSNotificationCenter 6 | #if _runtime(_ObjC) 7 | private var token: AnyObject? 8 | #else 9 | private var token: NSObjectProtocol? 10 | #endif 11 | 12 | required init(notificationCenter: NSNotificationCenter) { 13 | self.notificationCenter = notificationCenter 14 | self.observedNotifications = [] 15 | } 16 | 17 | func startObserving() { 18 | self.token = self.notificationCenter.addObserverForName(nil, object: nil, queue: nil) { 19 | // linux-swift gets confused by .append(n) 20 | [weak self] n in self?.observedNotifications += [n] 21 | } 22 | } 23 | 24 | deinit { 25 | #if _runtime(_ObjC) 26 | if let token = self.token { 27 | self.notificationCenter.removeObserver(token) 28 | } 29 | #else 30 | if let token = self.token as? AnyObject { 31 | self.notificationCenter.removeObserver(token) 32 | } 33 | #endif 34 | } 35 | } 36 | 37 | private let mainThread = pthread_self() 38 | 39 | public func postNotifications( 40 | notificationsMatcher: T, 41 | fromNotificationCenter center: NSNotificationCenter = NSNotificationCenter.defaultCenter()) 42 | -> MatcherFunc { 43 | let _ = mainThread // Force lazy-loading of this value 44 | let collector = NotificationCollector(notificationCenter: center) 45 | collector.startObserving() 46 | var once: Bool = false 47 | return MatcherFunc { actualExpression, failureMessage in 48 | let collectorNotificationsExpression = Expression(memoizedExpression: { _ in 49 | return collector.observedNotifications 50 | }, location: actualExpression.location, withoutCaching: true) 51 | 52 | assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.") 53 | if !once { 54 | once = true 55 | try actualExpression.evaluate() 56 | } 57 | 58 | let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage) 59 | if collector.observedNotifications.isEmpty { 60 | failureMessage.actualValue = "no notifications" 61 | } else { 62 | failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>" 63 | } 64 | return match 65 | } 66 | } -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Expectation.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | internal func expressionMatches(expression: Expression, matcher: U, to: String, description: String?) -> (Bool, FailureMessage) { 4 | let msg = FailureMessage() 5 | msg.userDescription = description 6 | msg.to = to 7 | do { 8 | let pass = try matcher.matches(expression, failureMessage: msg) 9 | if msg.actualValue == "" { 10 | msg.actualValue = "<\(stringify(try expression.evaluate()))>" 11 | } 12 | return (pass, msg) 13 | } catch let error { 14 | msg.actualValue = "an unexpected error thrown: <\(error)>" 15 | return (false, msg) 16 | } 17 | } 18 | 19 | internal func expressionDoesNotMatch(expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) { 20 | let msg = FailureMessage() 21 | msg.userDescription = description 22 | msg.to = toNot 23 | do { 24 | let pass = try matcher.doesNotMatch(expression, failureMessage: msg) 25 | if msg.actualValue == "" { 26 | msg.actualValue = "<\(stringify(try expression.evaluate()))>" 27 | } 28 | return (pass, msg) 29 | } catch let error { 30 | msg.actualValue = "an unexpected error thrown: <\(error)>" 31 | return (false, msg) 32 | } 33 | } 34 | 35 | public struct Expectation { 36 | let expression: Expression 37 | 38 | public func verify(pass: Bool, _ message: FailureMessage) { 39 | let handler = NimbleEnvironment.activeInstance.assertionHandler 40 | handler.assert(pass, message: message, location: expression.location) 41 | } 42 | 43 | /// Tests the actual value using a matcher to match. 44 | public func to(matcher: U, description: String? = nil) { 45 | let (pass, msg) = expressionMatches(expression, matcher: matcher, to: "to", description: description) 46 | verify(pass, msg) 47 | } 48 | 49 | /// Tests the actual value using a matcher to not match. 50 | public func toNot(matcher: U, description: String? = nil) { 51 | let (pass, msg) = expressionDoesNotMatch(expression, matcher: matcher, toNot: "to not", description: description) 52 | verify(pass, msg) 53 | } 54 | 55 | /// Tests the actual value using a matcher to not match. 56 | /// 57 | /// Alias to toNot(). 58 | public func notTo(matcher: U, description: String? = nil) { 59 | toNot(matcher, description: description) 60 | } 61 | 62 | // see: 63 | // - AsyncMatcherWrapper for extension 64 | // - NMBExpectation for Objective-C interface 65 | } 66 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value matches with any of the matchers 4 | /// provided in the variable list of matchers. 5 | public func satisfyAnyOf(matchers: U...) -> NonNilMatcherFunc { 6 | return satisfyAnyOf(matchers) 7 | } 8 | 9 | internal func satisfyAnyOf(matchers: [U]) -> NonNilMatcherFunc { 10 | return NonNilMatcherFunc { actualExpression, failureMessage in 11 | let postfixMessages = NSMutableArray() 12 | var matches = false 13 | for matcher in matchers { 14 | if try matcher.matches(actualExpression, failureMessage: failureMessage) { 15 | matches = true 16 | } 17 | postfixMessages.addObject(NSString(string: "{\(failureMessage.postfixMessage)}")) 18 | } 19 | 20 | failureMessage.postfixMessage = "match one of: " + postfixMessages.componentsJoinedByString(", or ") 21 | if let actualValue = try actualExpression.evaluate() { 22 | failureMessage.actualValue = "\(actualValue)" 23 | } 24 | 25 | return matches 26 | } 27 | } 28 | 29 | public func ||(left: NonNilMatcherFunc, right: NonNilMatcherFunc) -> NonNilMatcherFunc { 30 | return satisfyAnyOf(left, right) 31 | } 32 | 33 | public func ||(left: FullMatcherFunc, right: FullMatcherFunc) -> NonNilMatcherFunc { 34 | return satisfyAnyOf(left, right) 35 | } 36 | 37 | public func ||(left: MatcherFunc, right: MatcherFunc) -> NonNilMatcherFunc { 38 | return satisfyAnyOf(left, right) 39 | } 40 | 41 | #if _runtime(_ObjC) 42 | extension NMBObjCMatcher { 43 | public class func satisfyAnyOfMatcher(matchers: [NMBObjCMatcher]) -> NMBObjCMatcher { 44 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 45 | if matchers.isEmpty { 46 | failureMessage.stringValue = "satisfyAnyOf must be called with at least one matcher" 47 | return false 48 | } 49 | 50 | var elementEvaluators = [NonNilMatcherFunc]() 51 | for matcher in matchers { 52 | let elementEvaluator: (Expression, FailureMessage) -> Bool = { 53 | expression, failureMessage in 54 | return matcher.matches( 55 | {try! expression.evaluate()}, failureMessage: failureMessage, location: actualExpression.location) 56 | } 57 | 58 | elementEvaluators.append(NonNilMatcherFunc(elementEvaluator)) 59 | } 60 | 61 | return try! satisfyAnyOf(elementEvaluators).matches(actualExpression, failureMessage: failureMessage) 62 | } 63 | } 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/DSL.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Make an expectation on a given actual value. The value given is lazily evaluated. 4 | @warn_unused_result(message="Follow 'expect(…)' with '.to(…)', '.toNot(…)', 'toEventually(…)', '==', etc.") 5 | public func expect(@autoclosure(escaping) expression: () throws -> T?, file: FileString = __FILE__, line: UInt = __LINE__) -> Expectation { 6 | return Expectation( 7 | expression: Expression( 8 | expression: expression, 9 | location: SourceLocation(file: file, line: line), 10 | isClosure: true)) 11 | } 12 | 13 | /// Make an expectation on a given actual value. The closure is lazily invoked. 14 | @warn_unused_result(message="Follow 'expect(…)' with '.to(…)', '.toNot(…)', 'toEventually(…)', '==', etc.") 15 | public func expect(file: FileString = __FILE__, line: UInt = __LINE__, expression: () throws -> T?) -> Expectation { 16 | return Expectation( 17 | expression: Expression( 18 | expression: expression, 19 | location: SourceLocation(file: file, line: line), 20 | isClosure: true)) 21 | } 22 | 23 | /// Always fails the test with a message and a specified location. 24 | public func fail(message: String, location: SourceLocation) { 25 | let handler = NimbleEnvironment.activeInstance.assertionHandler 26 | handler.assert(false, message: FailureMessage(stringValue: message), location: location) 27 | } 28 | 29 | /// Always fails the test with a message. 30 | public func fail(message: String, file: FileString = __FILE__, line: UInt = __LINE__) { 31 | fail(message, location: SourceLocation(file: file, line: line)) 32 | } 33 | 34 | /// Always fails the test. 35 | public func fail(file: FileString = __FILE__, line: UInt = __LINE__) { 36 | fail("fail() always fails", file: file, line: line) 37 | } 38 | 39 | /// Like Swift's precondition(), but raises NSExceptions instead of sigaborts 40 | internal func nimblePrecondition( 41 | @autoclosure expr: () -> Bool, 42 | @autoclosure _ name: () -> String, 43 | @autoclosure _ message: () -> String, 44 | file: StaticString = __FILE__, 45 | line: UInt = __LINE__) -> Bool { 46 | let result = expr() 47 | if !result { 48 | #if _runtime(_ObjC) 49 | let e = NSException( 50 | name: name(), 51 | reason: message(), 52 | userInfo: nil) 53 | e.raise() 54 | #else 55 | preconditionFailure("\(name()) - \(message())", file: file, line: line) 56 | #endif 57 | } 58 | return result 59 | } 60 | 61 | @noreturn 62 | internal func internalError(msg: String, file: FileString = __FILE__, line: UInt = __LINE__) { 63 | fatalError( 64 | "Nimble Bug Found: \(msg) at \(file):\(line).\n" + 65 | "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + 66 | "code snippet that caused this error." 67 | ) 68 | } -------------------------------------------------------------------------------- /Demo/LeeGo/Tweet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Tweet.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 29/02/16. 6 | // Copyright © 2016 LeeGo. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import LeeGo 11 | 12 | struct Tweet { 13 | let id: String 14 | let favorited: Bool 15 | let truncated: Bool 16 | let hashTags: [[String: AnyObject]] 17 | let text: String 18 | let retweetCount: Int 19 | let favouritesCount: Int 20 | let createdAt: NSDate 21 | let userName: String 22 | let screenName: String 23 | let avatarUrl: NSURL? 24 | 25 | init(json: [String: AnyObject]) { 26 | id = json["id_str"] as? String ?? "" 27 | favorited = json["favorited"] as? Bool ?? false 28 | truncated = json["truncated"] as? Bool ?? false 29 | hashTags = json["hashtags"] as? [[String: AnyObject]] ?? [] 30 | text = json["text"] as? String ?? "" 31 | retweetCount = json["retweet_count"] as? Int ?? 0 32 | favouritesCount = json["user"]!["favourites_count"] as? Int ?? 0 33 | createdAt = NSDate() 34 | userName = json["user"]!["name"] as? String ?? "" 35 | screenName = json["user"]!["screen_name"] as? String ?? "" 36 | avatarUrl = NSURL(string: (json["profile_image_url_https"] as? String) ?? "") 37 | } 38 | } 39 | 40 | extension Tweet { 41 | static func tweets(jsonArray: [[String: AnyObject]]) -> [Tweet] { 42 | return jsonArray.map({ (json) -> Tweet in 43 | return Tweet(json: json) 44 | }) 45 | } 46 | } 47 | 48 | extension Tweet: BrickDataSource { 49 | 50 | func update(targetView: UIView, with brick: Brick) { 51 | switch targetView { 52 | case let textView as UITextView where brick == Twitter.tweetText: 53 | textView.text = text 54 | case let label as UILabel where brick == Twitter.username: 55 | label.text = userName 56 | case let label as UILabel where brick == Twitter.account: 57 | label.text = "@" + screenName 58 | case let label as UILabel where brick == Twitter.date: 59 | label.text = "2d" // just example 60 | case let button as UIButton where brick == Twitter.retweetButton: 61 | button.setTitle("\(retweetCount)", forState: .Normal) 62 | case let button as UIButton where brick == Twitter.likeButton: 63 | button.setTitle("\(favouritesCount)", forState: .Normal) 64 | default: 65 | break 66 | } 67 | } 68 | } 69 | 70 | extension UIButton { 71 | public override func lg_setupCustomStyle(style: [String: AnyObject]) { 72 | if let font = style["buttonTitleFont"] as? UIFont { 73 | self.titleLabel?.font = font 74 | } 75 | } 76 | 77 | public override func lg_removeCustomStyle(style: [String: AnyObject]) { 78 | if let _ = style["buttonTitleFont"] as? UIFont { 79 | self.titleLabel?.font = nil 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | 4 | /// A Nimble matcher that succeeds when the actual sequence's last element 5 | /// is equal to the expected value. 6 | public func endWith(endingElement: T) -> NonNilMatcherFunc { 7 | return NonNilMatcherFunc { actualExpression, failureMessage in 8 | failureMessage.postfixMessage = "end with <\(endingElement)>" 9 | 10 | if let actualValue = try actualExpression.evaluate() { 11 | var actualGenerator = actualValue.generate() 12 | var lastItem: T? 13 | var item: T? 14 | repeat { 15 | lastItem = item 16 | item = actualGenerator.next() 17 | } while(item != nil) 18 | 19 | return lastItem == endingElement 20 | } 21 | return false 22 | } 23 | } 24 | 25 | /// A Nimble matcher that succeeds when the actual collection's last element 26 | /// is equal to the expected object. 27 | public func endWith(endingElement: AnyObject) -> NonNilMatcherFunc { 28 | return NonNilMatcherFunc { actualExpression, failureMessage in 29 | failureMessage.postfixMessage = "end with <\(endingElement)>" 30 | let collection = try actualExpression.evaluate() 31 | return collection != nil && collection!.indexOfObject(endingElement) == collection!.count - 1 32 | } 33 | } 34 | 35 | 36 | /// A Nimble matcher that succeeds when the actual string contains the expected substring 37 | /// where the expected substring's location is the actual string's length minus the 38 | /// expected substring's length. 39 | public func endWith(endingSubstring: String) -> NonNilMatcherFunc { 40 | return NonNilMatcherFunc { actualExpression, failureMessage in 41 | failureMessage.postfixMessage = "end with <\(endingSubstring)>" 42 | if let collection = try actualExpression.evaluate() { 43 | let range = collection.rangeOfString(endingSubstring) 44 | return range != nil && range!.endIndex == collection.endIndex 45 | } 46 | return false 47 | } 48 | } 49 | 50 | #if _runtime(_ObjC) 51 | extension NMBObjCMatcher { 52 | public class func endWithMatcher(expected: AnyObject) -> NMBObjCMatcher { 53 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 54 | let actual = try! actualExpression.evaluate() 55 | if let _ = actual as? String { 56 | let expr = actualExpression.cast { $0 as? String } 57 | return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage) 58 | } else { 59 | let expr = actualExpression.cast { $0 as? NMBOrderedCollection } 60 | return try! endWith(expected).matches(expr, failureMessage: failureMessage) 61 | } 62 | } 63 | } 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/DSL/QCKDSL.m: -------------------------------------------------------------------------------- 1 | #import "QCKDSL.h" 2 | #import "World.h" 3 | #import "World+DSL.h" 4 | 5 | void qck_beforeSuite(QCKDSLEmptyBlock closure) { 6 | [[World sharedWorld] beforeSuite:closure]; 7 | } 8 | 9 | void qck_afterSuite(QCKDSLEmptyBlock closure) { 10 | [[World sharedWorld] afterSuite:closure]; 11 | } 12 | 13 | void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) { 14 | [[World sharedWorld] sharedExamples:name closure:closure]; 15 | } 16 | 17 | void qck_describe(NSString *description, QCKDSLEmptyBlock closure) { 18 | [[World sharedWorld] describe:description flags:@{} closure:closure]; 19 | } 20 | 21 | void qck_context(NSString *description, QCKDSLEmptyBlock closure) { 22 | qck_describe(description, closure); 23 | } 24 | 25 | void qck_beforeEach(QCKDSLEmptyBlock closure) { 26 | [[World sharedWorld] beforeEach:closure]; 27 | } 28 | 29 | void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) { 30 | [[World sharedWorld] beforeEachWithMetadata:closure]; 31 | } 32 | 33 | void qck_afterEach(QCKDSLEmptyBlock closure) { 34 | [[World sharedWorld] afterEach:closure]; 35 | } 36 | 37 | void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) { 38 | [[World sharedWorld] afterEachWithMetadata:closure]; 39 | } 40 | 41 | QCKItBlock qck_it_builder(NSDictionary *flags, NSString *file, NSUInteger line) { 42 | return ^(NSString *description, QCKDSLEmptyBlock closure) { 43 | [[World sharedWorld] itWithDescription:description 44 | flags:flags 45 | file:file 46 | line:line 47 | closure:closure]; 48 | }; 49 | } 50 | 51 | QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSDictionary *flags, NSString *file, NSUInteger line) { 52 | return ^(NSString *name, QCKDSLSharedExampleContext context) { 53 | [[World sharedWorld] itBehavesLikeSharedExampleNamed:name 54 | sharedExampleContext:context 55 | flags:flags 56 | file:file 57 | line:line]; 58 | }; 59 | } 60 | 61 | void qck_pending(NSString *description, QCKDSLEmptyBlock closure) { 62 | [[World sharedWorld] pending:description closure:closure]; 63 | } 64 | 65 | void qck_xdescribe(NSString *description, QCKDSLEmptyBlock closure) { 66 | [[World sharedWorld] xdescribe:description flags:@{} closure:closure]; 67 | } 68 | 69 | void qck_xcontext(NSString *description, QCKDSLEmptyBlock closure) { 70 | qck_xdescribe(description, closure); 71 | } 72 | 73 | void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure) { 74 | [[World sharedWorld] fdescribe:description flags:@{} closure:closure]; 75 | } 76 | 77 | void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure) { 78 | qck_fdescribe(description, closure); 79 | } 80 | -------------------------------------------------------------------------------- /LeeGoTests/LayoutSpec.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigurationSpecs.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 20/02/16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | import Foundation 11 | import UIKit 12 | 13 | import Quick 14 | import Nimble 15 | @testable import LeeGo 16 | 17 | class LayoutSpec: QuickSpec { 18 | override func spec() { 19 | 20 | describe("Layout Metrics tests") { 21 | it("should create a metrics instance correctly") { 22 | let metrics = LayoutMetrics(top: 20, left: 20, bottom: 20, right: 20, spaceH: 10, spaceV: 10, customMetrics: ["custom": 17]) 23 | 24 | expect(metrics.top) == 20 25 | expect(metrics.left) == 20 26 | expect(metrics.bottom) == 20 27 | expect(metrics.right) == 20 28 | expect(metrics.spaceH) == 10 29 | expect(metrics.spaceV) == 10 30 | expect(metrics.customMetrics) == ["custom": 17] 31 | } 32 | 33 | it("should return metrics correctly") { 34 | let metrics = LayoutMetrics(top: 20, left: 20, bottom: 20, right: 20, spaceH: 10, spaceV: 10, customMetrics: ["custom": 17]) 35 | 36 | let result = metrics.metrics() 37 | 38 | expect(result) == ["top": 20, "left": 20, "bottom": 20, "right": 20, "spaceH": 10, "spaceV": 10, "custom": 17] 39 | } 40 | 41 | it("should compare two metrics instances correctly") { 42 | let metrics1 = LayoutMetrics(top: 20, left: 20, bottom: 20, right: 20, spaceH: 10, spaceV: 10, customMetrics: ["custom": 17]) 43 | let metrics2 = LayoutMetrics(top: 20, left: 20, bottom: 20, right: 20, spaceH: 10, spaceV: 10, customMetrics: ["custom": 17]) 44 | let metrics3 = LayoutMetrics(top: 20, left: 20, bottom: 20, right: 20, spaceH: 10, spaceV: 10, customMetrics: ["custom": 18]) 45 | 46 | expect(metrics1) == metrics2 47 | expect(metrics2) != metrics3 48 | } 49 | } 50 | 51 | 52 | describe("Layout tests") { 53 | it("should create an empty layout") { 54 | let layout = Layout() 55 | expect(layout.formats) == [] 56 | } 57 | 58 | it("should create layout with formats") { 59 | let mockFormat = ["format1", "format2"] 60 | let layout = Layout(mockFormat) 61 | 62 | expect(layout.formats) == mockFormat 63 | expect(layout.formats) != ["format2", "format2"] 64 | } 65 | 66 | it("should compare two layout instances correctly") { 67 | let layout1 = Layout(["format1", "format2"], options: NSLayoutFormatOptions.AlignAllBottom, metrics: LayoutMetrics(20, 20, 20, 20 ,10 ,10)) 68 | let layout2 = Layout(["format1", "format2"], options: NSLayoutFormatOptions.AlignAllBottom, metrics: LayoutMetrics(20, 20, 20, 20 ,10 ,10)) 69 | expect(layout1) == layout2 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import XCTest 3 | 4 | /// Default handler for Nimble. This assertion handler passes failures along to 5 | /// XCTest. 6 | public class NimbleXCTestHandler : AssertionHandler { 7 | public func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { 8 | if !assertion { 9 | recordFailure("\(message.stringValue)\n", location: location) 10 | } 11 | } 12 | } 13 | 14 | /// Alternative handler for Nimble. This assertion handler passes failures along 15 | /// to XCTest by attempting to reduce the failure message size. 16 | public class NimbleShortXCTestHandler: AssertionHandler { 17 | public func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { 18 | if !assertion { 19 | let msg: String 20 | if let actual = message.actualValue { 21 | msg = "got: \(actual) \(message.postfixActual)" 22 | } else { 23 | msg = "expected \(message.to) \(message.postfixMessage)" 24 | } 25 | recordFailure("\(msg)\n", location: location) 26 | } 27 | } 28 | } 29 | 30 | /// Fallback handler in case XCTest is unavailable. This assertion handler will abort 31 | /// the program if it is invoked. 32 | class NimbleXCTestUnavailableHandler : AssertionHandler { 33 | func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { 34 | fatalError("XCTest is not available and no custom assertion handler was configured. Aborting.") 35 | } 36 | } 37 | 38 | #if _runtime(_ObjC) 39 | /// Helper class providing access to the currently executing XCTestCase instance, if any 40 | @objc final internal class CurrentTestCaseTracker: NSObject, XCTestObservation { 41 | @objc static let sharedInstance = CurrentTestCaseTracker() 42 | 43 | private(set) var currentTestCase: XCTestCase? 44 | 45 | @objc func testCaseWillStart(testCase: XCTestCase) { 46 | currentTestCase = testCase 47 | } 48 | 49 | @objc func testCaseDidFinish(testCase: XCTestCase) { 50 | currentTestCase = nil 51 | } 52 | } 53 | #endif 54 | 55 | 56 | func isXCTestAvailable() -> Bool { 57 | #if _runtime(_ObjC) 58 | // XCTest is weakly linked and so may not be present 59 | return NSClassFromString("XCTestCase") != nil 60 | #else 61 | return true 62 | #endif 63 | } 64 | 65 | private func recordFailure(message: String, location: SourceLocation) { 66 | #if _runtime(_ObjC) 67 | if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { 68 | testCase.recordFailureWithDescription(message, inFile: location.file, atLine: location.line, expected: true) 69 | } else { 70 | let msg = "Attempted to report a test failure to XCTest while no test case was running. " + 71 | "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)" 72 | NSException(name: NSInternalInconsistencyException, reason: msg, userInfo: nil).raise() 73 | } 74 | #else 75 | XCTFail("\(message)\n", file: location.file, line: location.line) 76 | #endif 77 | } 78 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.m: -------------------------------------------------------------------------------- 1 | #import "QuickConfiguration.h" 2 | #import "World.h" 3 | #import 4 | 5 | typedef void (^QCKClassEnumerationBlock)(Class klass); 6 | 7 | /** 8 | Finds all direct subclasses of the given class and passes them to the block provided. 9 | The classes are iterated over in the order that objc_getClassList returns them. 10 | 11 | @param klass The base class to find subclasses of. 12 | @param block A block that takes a Class. This block will be executed once for each subclass of klass. 13 | */ 14 | void qck_enumerateSubclasses(Class klass, QCKClassEnumerationBlock block) { 15 | Class *classes = NULL; 16 | int classesCount = objc_getClassList(NULL, 0); 17 | 18 | if (classesCount > 0) { 19 | classes = (Class *)calloc(sizeof(Class), classesCount); 20 | classesCount = objc_getClassList(classes, classesCount); 21 | 22 | Class subclass, superclass; 23 | for(int i = 0; i < classesCount; i++) { 24 | subclass = classes[i]; 25 | superclass = class_getSuperclass(subclass); 26 | if (superclass == klass && block) { 27 | block(subclass); 28 | } 29 | } 30 | 31 | free(classes); 32 | } 33 | } 34 | 35 | @implementation QuickConfiguration 36 | 37 | #pragma mark - Object Lifecycle 38 | 39 | /** 40 | QuickConfiguration is not meant to be instantiated; it merely provides a hook 41 | for users to configure how Quick behaves. Raise an exception if an instance of 42 | QuickConfiguration is created. 43 | */ 44 | - (instancetype)init { 45 | NSString *className = NSStringFromClass([self class]); 46 | NSString *selectorName = NSStringFromSelector(@selector(configure:)); 47 | [NSException raise:NSInternalInconsistencyException 48 | format:@"%@ is not meant to be instantiated; " 49 | @"subclass %@ and override %@ to configure Quick.", 50 | className, className, selectorName]; 51 | return nil; 52 | } 53 | 54 | #pragma mark - NSObject Overrides 55 | 56 | /** 57 | Hook into when QuickConfiguration is initialized in the runtime in order to 58 | call +[QuickConfiguration configure:] on each of its subclasses. 59 | */ 60 | + (void)initialize { 61 | // Only enumerate over the subclasses of QuickConfiguration, not any of its subclasses. 62 | if ([self class] == [QuickConfiguration class]) { 63 | 64 | // Only enumerate over subclasses once, even if +[QuickConfiguration initialize] 65 | // were to be called several times. This is necessary because +[QuickSpec initialize] 66 | // manually calls +[QuickConfiguration initialize]. 67 | static dispatch_once_t onceToken; 68 | dispatch_once(&onceToken, ^{ 69 | qck_enumerateSubclasses([QuickConfiguration class], ^(__unsafe_unretained Class klass) { 70 | [[World sharedWorld] configure:^(Configuration *configuration) { 71 | [klass configure:configuration]; 72 | }]; 73 | }); 74 | [[World sharedWorld] finalizeConfiguration]; 75 | }); 76 | } 77 | } 78 | 79 | #pragma mark - Public Interface 80 | 81 | + (void)configure:(Configuration *)configuration { } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /Demo/LeeGo/TwitterFeedViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TwitterFeedViewController.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 29/02/16. 6 | // Copyright © 2016 LeeGo. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import LeeGo 12 | 13 | class TwitterFeedViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout { 14 | 15 | private var elements = [Tweet]() 16 | 17 | override func awakeFromNib() { 18 | super.awakeFromNib() 19 | 20 | for reuseId in Twitter.reuseIdentifiers { 21 | collectionView?.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseId) 22 | } 23 | } 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | 28 | (collectionView?.collectionViewLayout as! UICollectionViewFlowLayout).estimatedItemSize = CGSizeMake(self.view.frame.width, 280) 29 | 30 | if let path = NSBundle.mainBundle().pathForResource("twitter_sample", ofType: "json"), 31 | let data = NSData(contentsOfFile: path), 32 | let optionalValue = try? NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions(rawValue: 0)) as? Dictionary, 33 | let value = optionalValue, 34 | let elementDictionaries = value["statuses"] as? [[String: AnyObject]] where elements.isEmpty { 35 | elements = Tweet.tweets(elementDictionaries) 36 | } 37 | } 38 | 39 | // MARK: Collection View DataSource 40 | 41 | override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 42 | return elements.count 43 | } 44 | 45 | override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 46 | 47 | let tweetBrick = Twitter.tweet.brick() 48 | 49 | let cell = collectionView.dequeueReusableCellWithReuseIdentifier(tweetBrick.name, forIndexPath: indexPath) 50 | 51 | cell.lg_configureAs(tweetBrick, dataSource: elements[indexPath.item]) 52 | 53 | return cell 54 | } 55 | 56 | // MARK: Collection View Layout 57 | 58 | func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { 59 | return CGSizeMake(CGRectGetWidth(collectionView.frame), 180) 60 | } 61 | 62 | func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAtIndex section: Int) -> CGFloat { 63 | return 0.5 64 | } 65 | 66 | // MARK: size 67 | override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { 68 | coordinator.animateAlongsideTransition({ (context) -> Void in 69 | (self.collectionView?.collectionViewLayout as! UICollectionViewFlowLayout).estimatedItemSize = CGSizeMake(self.view.frame.width, 280) 70 | self.collectionView?.reloadData() 71 | }, completion: nil) 72 | 73 | super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Sources/Core/Composable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Composable.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 21/02/16. 6 | // 7 | // 8 | 9 | import Foundation 10 | 11 | protocol Composable { 12 | func composite(bricks: [Brick], to targetView: View, with layout: Layout) 13 | } 14 | 15 | extension Composable { 16 | internal func composite(bricks: [Brick], to targetView: View, with layout: Layout) { 17 | 18 | // remove subviews which do not exist anymore in bricks 19 | for subview in targetView.subviews { 20 | if let oldBrick = subview.currentBrick where !bricks.contains(oldBrick) { 21 | subview.removeFromSuperview() 22 | } 23 | } 24 | 25 | // filter bricks already exist 26 | let filteredBricks = bricks.filter { (subBrick) -> Bool in 27 | if let subbricks = targetView.currentBrick?.bricks where subbricks.contains(subBrick) { 28 | for subview in targetView.subviews { 29 | if let subbrick2 = subview.currentBrick where subbrick2 == subBrick { 30 | return false 31 | } 32 | } 33 | } 34 | return true 35 | } 36 | 37 | filteredBricks.forEach { brick in 38 | var view: UIView? = nil; 39 | 40 | if let nibName = brick.nibName, 41 | let brickView = NSBundle.mainBundle().loadNibNamed(nibName, owner: nil, options: nil).first as? UIView { 42 | view = brickView 43 | } else if let targetClass = brick.targetClass as? UIView.Type { 44 | view = targetClass.init() 45 | } 46 | 47 | view?.isRoot = false 48 | view?.currentBrick = Brick(name: brick.name, targetClass: brick.targetClass, nibName: brick.nibName) 49 | if let view = view { 50 | targetView.addSubview(view) 51 | view.lg_brickDidAwake() 52 | } 53 | } 54 | 55 | //TODO: sort brick's subviews to have as same order as bricks 56 | var viewsDictionary = [String: UIView]() 57 | for subview in targetView.subviews { 58 | if let name = subview.currentBrick?.name { 59 | viewsDictionary[name] = subview 60 | } 61 | } 62 | 63 | // Remove constraint with identifier (which means not created by system) 64 | targetView.removeConstraints(targetView.constraints.filter({ (constraint) -> Bool in 65 | if constraint.mode == .SubviewsLayout { 66 | return true 67 | } 68 | return false 69 | })) 70 | 71 | // Layout each view with auto layout visual format language as brick. 72 | for format in layout.formats { 73 | let constraints = NSLayoutConstraint.constraintsWithVisualFormat(format, options: layout.options, metrics: layout.metrics.metrics(), views: viewsDictionary) 74 | for constraint in constraints { 75 | constraint.lg_setIdentifier(with: .SubviewsLayout) 76 | targetView.addConstraint(constraint) 77 | } 78 | } 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /Demo/LeeGo/standard_brick.json: -------------------------------------------------------------------------------- 1 | { 2 | "layout" : { 3 | "options" : [ 4 | "DirectionLeadingToTrailing" 5 | ], 6 | "formats" : [ 7 | "H:|-left-[avatar]-spaceH-[title]-right-|", 8 | "H:|-left-[avatar]-spaceH-[subtitle]-right-|", 9 | "V:|-top-[title]-spaceV-[subtitle]-(>=bottom)-|", 10 | "V:|-top-[avatar]-(>=bottom)-|" 11 | ], 12 | "metrics" : { 13 | "left" : 20, 14 | "right" : 20, 15 | "spaceH" : 10, 16 | "bottom" : 20, 17 | "top" : 20, 18 | "spaceV" : 10 19 | } 20 | }, 21 | "name" : "article", 22 | "style" : { 23 | "backgroundColor" : "#FFFFFFFF" 24 | }, 25 | "components" : [ 26 | { 27 | "targetClass" : "UILabel", 28 | "style" : { 29 | "attributedText" : [ 30 | { 31 | "NSFont" : { 32 | "size" : 16, 33 | "name" : "Helvetica" 34 | }, 35 | "NSColor" : "#FF0000FF" 36 | }, 37 | { 38 | "NSFont" : { 39 | "size" : 20, 40 | "name" : "Avenir-Book" 41 | }, 42 | "NSColor" : "#000000FF" 43 | }, 44 | { 45 | "NSFont" : { 46 | "size" : 16, 47 | "name" : "Avenir-Book" 48 | }, 49 | "NSColor" : "#AAAAAAFF" 50 | } 51 | ], 52 | "translatesAutoresizingMaskIntoConstraints" : false, 53 | "numberOfLines" : 0 54 | }, 55 | "name" : "title" 56 | }, 57 | { 58 | "targetClass" : "UILabel", 59 | "style" : { 60 | "numberOfLines" : 0, 61 | "textColor" : "#AAAAAAFF", 62 | "text" : "Default text", 63 | "font" : { 64 | "size" : 12, 65 | "name" : ".SFUIText-Regular" 66 | } 67 | }, 68 | "name" : "subtitle" 69 | }, 70 | { 71 | "name" : "avatar", 72 | "style" : { 73 | "backgroundColor" : "#00FF00FF", 74 | "ratio" : 1.5 75 | }, 76 | "width" : 68.0, 77 | "targetClass" : "UIImageView" 78 | } 79 | ], 80 | "targetClass" : "UIView" 81 | } -------------------------------------------------------------------------------- /LeeGoTests/brick.json: -------------------------------------------------------------------------------- 1 | { 2 | "layout" : { 3 | "options" : [ 4 | "DirectionLeadingToTrailing" 5 | ], 6 | "formats" : [ 7 | "H:|-left-[avatar]-spaceH-[title]-right-|", 8 | "H:|-left-[avatar]-spaceH-[subtitle]-right-|", 9 | "V:|-top-[title]-spaceV-[subtitle]-(>=bottom)-|", 10 | "V:|-top-[avatar]-(>=bottom)-|" 11 | ], 12 | "metrics" : { 13 | "left" : 20, 14 | "right" : 20, 15 | "spaceH" : 10, 16 | "bottom" : 20, 17 | "top" : 20, 18 | "spaceV" : 10 19 | } 20 | }, 21 | "name" : "article", 22 | "height" : 60.0, 23 | "outlet" : "button", 24 | "style" : { 25 | "backgroundColor" : "#FFFFFF" 26 | }, 27 | "bricks" : [ 28 | { 29 | "targetClass" : "UILabel", 30 | "style" : { 31 | "attributedText" : [ 32 | { 33 | "NSFont" : { 34 | "size" : 16, 35 | "name" : "Helvetica" 36 | }, 37 | "NSColor" : "#FF0000" 38 | }, 39 | { 40 | "NSFont" : { 41 | "size" : 20, 42 | "name" : "Avenir-Book" 43 | }, 44 | "NSColor" : "#000000" 45 | }, 46 | { 47 | "NSFont" : { 48 | "size" : 16, 49 | "name" : "Avenir-Book" 50 | }, 51 | "NSColor" : "#AAAAAA" 52 | } 53 | ], 54 | "translatesAutoresizingMaskIntoConstraints" : false, 55 | "numberOfLines" : 0 56 | }, 57 | "name" : "title" 58 | }, 59 | { 60 | "targetClass" : "UILabel", 61 | "style" : { 62 | "numberOfLines" : 0, 63 | "textColor" : "#AAAAAA", 64 | "text" : "Default text", 65 | "font" : { 66 | "size" : 12, 67 | "name" : ".SFUIText-Regular" 68 | } 69 | }, 70 | "name" : "subtitle" 71 | }, 72 | { 73 | "name" : "avatar", 74 | "style" : { 75 | "backgroundColor" : "#00FF00", 76 | "ratio" : 1.5 77 | }, 78 | "width" : 68.0, 79 | "targetClass" : "UIImageView" 80 | } 81 | ], 82 | "targetClass" : "UIView" 83 | } -------------------------------------------------------------------------------- /Pods/Nimble/Sources/Nimble/Wrappers/ObjCMatcher.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | #if _runtime(_ObjC) 4 | 5 | public typealias MatcherBlock = (actualExpression: Expression, failureMessage: FailureMessage) -> Bool 6 | public typealias FullMatcherBlock = (actualExpression: Expression, failureMessage: FailureMessage, shouldNotMatch: Bool) -> Bool 7 | 8 | public class NMBObjCMatcher : NSObject, NMBMatcher { 9 | let _match: MatcherBlock 10 | let _doesNotMatch: MatcherBlock 11 | let canMatchNil: Bool 12 | 13 | public init(canMatchNil: Bool, matcher: MatcherBlock, notMatcher: MatcherBlock) { 14 | self.canMatchNil = canMatchNil 15 | self._match = matcher 16 | self._doesNotMatch = notMatcher 17 | } 18 | 19 | public convenience init(matcher: MatcherBlock) { 20 | self.init(canMatchNil: true, matcher: matcher) 21 | } 22 | 23 | public convenience init(canMatchNil: Bool, matcher: MatcherBlock) { 24 | self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in 25 | return !matcher(actualExpression: actualExpression, failureMessage: failureMessage) 26 | })) 27 | } 28 | 29 | public convenience init(matcher: FullMatcherBlock) { 30 | self.init(canMatchNil: true, matcher: matcher) 31 | } 32 | 33 | public convenience init(canMatchNil: Bool, matcher: FullMatcherBlock) { 34 | self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in 35 | return matcher(actualExpression: actualExpression, failureMessage: failureMessage, shouldNotMatch: false) 36 | }), notMatcher: ({ actualExpression, failureMessage in 37 | return matcher(actualExpression: actualExpression, failureMessage: failureMessage, shouldNotMatch: true) 38 | })) 39 | } 40 | 41 | private func canMatch(actualExpression: Expression, failureMessage: FailureMessage) -> Bool { 42 | do { 43 | if !canMatchNil { 44 | if try actualExpression.evaluate() == nil { 45 | failureMessage.postfixActual = " (use beNil() to match nils)" 46 | return false 47 | } 48 | } 49 | } catch let error { 50 | failureMessage.actualValue = "an unexpected error thrown: \(error)" 51 | return false 52 | } 53 | return true 54 | } 55 | 56 | public func matches(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { 57 | let expr = Expression(expression: actualBlock, location: location) 58 | let result = _match( 59 | actualExpression: expr, 60 | failureMessage: failureMessage) 61 | if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { 62 | return result 63 | } else { 64 | return false 65 | } 66 | } 67 | 68 | public func doesNotMatch(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { 69 | let expr = Expression(expression: actualBlock, location: location) 70 | let result = _doesNotMatch( 71 | actualExpression: expr, 72 | failureMessage: failureMessage) 73 | if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { 74 | return result 75 | } else { 76 | return false 77 | } 78 | } 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /Pods/Quick/Sources/Quick/ExampleGroup.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /** 4 | Example groups are logical groupings of examples, defined with 5 | the `describe` and `context` functions. Example groups can share 6 | setup and teardown code. 7 | */ 8 | final public class ExampleGroup: NSObject { 9 | weak internal var parent: ExampleGroup? 10 | internal let hooks = ExampleHooks() 11 | 12 | internal var phase: HooksPhase = .NothingExecuted 13 | 14 | private let internalDescription: String 15 | private let flags: FilterFlags 16 | private let isInternalRootExampleGroup: Bool 17 | private var childGroups = [ExampleGroup]() 18 | private var childExamples = [Example]() 19 | 20 | internal init(description: String, flags: FilterFlags, isInternalRootExampleGroup: Bool = false) { 21 | self.internalDescription = description 22 | self.flags = flags 23 | self.isInternalRootExampleGroup = isInternalRootExampleGroup 24 | } 25 | 26 | public override var description: String { 27 | return internalDescription 28 | } 29 | 30 | /** 31 | Returns a list of examples that belong to this example group, 32 | or to any of its descendant example groups. 33 | */ 34 | public var examples: [Example] { 35 | var examples = childExamples 36 | for group in childGroups { 37 | examples.appendContentsOf(group.examples) 38 | } 39 | return examples 40 | } 41 | 42 | internal var name: String? { 43 | if let parent = parent { 44 | switch(parent.name) { 45 | case .Some(let name): return "\(name), \(description)" 46 | case .None: return description 47 | } 48 | } else { 49 | return isInternalRootExampleGroup ? nil : description 50 | } 51 | } 52 | 53 | internal var filterFlags: FilterFlags { 54 | var aggregateFlags = flags 55 | walkUp() { (group: ExampleGroup) -> () in 56 | for (key, value) in group.flags { 57 | aggregateFlags[key] = value 58 | } 59 | } 60 | return aggregateFlags 61 | } 62 | 63 | internal var befores: [BeforeExampleWithMetadataClosure] { 64 | var closures = Array(hooks.befores.reverse()) 65 | walkUp() { (group: ExampleGroup) -> () in 66 | closures.appendContentsOf(Array(group.hooks.befores.reverse())) 67 | } 68 | return Array(closures.reverse()) 69 | } 70 | 71 | internal var afters: [AfterExampleWithMetadataClosure] { 72 | var closures = hooks.afters 73 | walkUp() { (group: ExampleGroup) -> () in 74 | closures.appendContentsOf(group.hooks.afters) 75 | } 76 | return closures 77 | } 78 | 79 | internal func walkDownExamples(callback: (example: Example) -> ()) { 80 | for example in childExamples { 81 | callback(example: example) 82 | } 83 | for group in childGroups { 84 | group.walkDownExamples(callback) 85 | } 86 | } 87 | 88 | internal func appendExampleGroup(group: ExampleGroup) { 89 | group.parent = self 90 | childGroups.append(group) 91 | } 92 | 93 | internal func appendExample(example: Example) { 94 | example.group = self 95 | childExamples.append(example) 96 | } 97 | 98 | private func walkUp(callback: (group: ExampleGroup) -> ()) { 99 | var group = self 100 | while let parent = group.parent { 101 | callback(group: parent) 102 | group = parent 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Demo/LeeGo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Demo/Pods-LeeGo-Demo-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | 86 | if [[ "$CONFIGURATION" == "Debug" ]]; then 87 | install_framework "Pods-LeeGo-Demo/LeeGo.framework" 88 | fi 89 | if [[ "$CONFIGURATION" == "Release" ]]; then 90 | install_framework "Pods-LeeGo-Demo/LeeGo.framework" 91 | fi 92 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-LeeGo-Tests/Pods-LeeGo-Tests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | 86 | if [[ "$CONFIGURATION" == "Debug" ]]; then 87 | install_framework "Pods-LeeGo-Tests/LeeGo.framework" 88 | fi 89 | if [[ "$CONFIGURATION" == "Release" ]]; then 90 | install_framework "Pods-LeeGo-Tests/LeeGo.framework" 91 | fi 92 | -------------------------------------------------------------------------------- /Demo/LeeGo/SamplesViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SamplesViewController.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 31/03/16. 6 | // Copyright © 2016 LeeGo. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import LeeGo 12 | 13 | class SamplesViewController: UITableViewController { 14 | 15 | private let elements = [ 16 | SampleItem(title: "Showcase 1", description: "Layout 3 blocks with `Top` alignment and `FillEqually` distribution"), 17 | SampleItem(title: "Showcase 2", description: "Layout 3 blocks with `Center` alignment and `FillEqually` distribution"), 18 | SampleItem(title: "Showcase 3", description: "Layout 3 blocks with `Bottom` alignment and `FillEqually` distribution"), 19 | SampleItem(title: "Showcase 4", description: "Layout 3 blocks with `Fill` alignment and `FillEqually` distribution"), 20 | SampleItem(title: "Showcase 5", description: "Layout 3 blocks with `Bottom` alignment and `Fill` distribution. Red block and green block have fixed width"), 21 | SampleItem(title: "Showcase 6", description: "Layout 3 blocks with `Top` alignment and `Flow(1)` distribution. All three blocks have fixed width"), 22 | SampleItem(title: "Showcase 7", description: "Layout 3 blocks with `Left` alignment and `FillEqually` distribution"), 23 | SampleItem(title: "Showcase 8", description: "Layout 3 blocks with `Center` alignment and `FillEqually` distribution"), 24 | SampleItem(title: "Showcase 9", description: "Layout 3 blocks with `Right` alignment and `FillEqually` distribution"), 25 | SampleItem(title: "Showcase 10", description: "Layout 3 blocks with `Fill` alignment and `FillEqually` distribution"), 26 | SampleItem(title: "Showcase 11", description: "Layout 3 blocks with `Left` alignment and `Fill` distribution"), 27 | SampleItem(title: "Showcase 12", description: "Layout 3 blocks with `Left` alignment and `Flow(1)` distribution")] 28 | 29 | override func awakeFromNib() { 30 | super.awakeFromNib() 31 | 32 | tableView?.allowsSelection = false 33 | tableView?.estimatedRowHeight = 44.0 34 | tableView?.rowHeight = UITableViewAutomaticDimension 35 | 36 | SimpleShowcase.reuseIdentifiers.forEach { (identifier) in 37 | tableView?.registerClass(UITableViewCell.self, forCellReuseIdentifier: identifier) 38 | } 39 | } 40 | 41 | override func viewDidLoad() { 42 | super.viewDidLoad() 43 | } 44 | 45 | // MARK: Datasource 46 | 47 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 48 | return elements.count 49 | } 50 | 51 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 52 | let brick = {_ -> Brick in 53 | switch indexPath.row { 54 | case 0: return SimpleShowcase.showcase1.brick() 55 | case 1: return SimpleShowcase.showcase2.brick() 56 | case 2: return SimpleShowcase.showcase3.brick() 57 | case 3: return SimpleShowcase.showcase4.brick() 58 | case 4: return SimpleShowcase.showcase5.brick() 59 | case 5: return SimpleShowcase.showcase6.brick() 60 | case 6: return SimpleShowcase.showcase7.brick() 61 | case 7: return SimpleShowcase.showcase8.brick() 62 | case 8: return SimpleShowcase.showcase9.brick() 63 | case 9: return SimpleShowcase.showcase10.brick() 64 | case 10: return SimpleShowcase.showcase11.brick() 65 | case 11: return SimpleShowcase.showcase12.brick() 66 | default: return SimpleShowcase.showcase1.brick() 67 | } 68 | }() 69 | 70 | let cell = tableView.dequeueReusableCellWithIdentifier(brick.name, forIndexPath: indexPath) 71 | 72 | cell.lg_configureAs(brick, dataSource:elements[indexPath.row], updatingStrategy: .Always) 73 | 74 | return cell 75 | } 76 | } 77 | 78 | 79 | -------------------------------------------------------------------------------- /LeeGoTests/ComponentTypeSpec.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BrickDescribableSpecs.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 20/02/16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | import Quick 13 | import Nimble 14 | @testable import LeeGo 15 | 16 | class BrickDescribableSpec: QuickSpec { 17 | override func spec() { 18 | 19 | describe("Configurable extension tests") { 20 | it("should setup style correctly.") { 21 | let view = UIView() 22 | view.setup(view, newStyle: [.backgroundColor(UIColor.greenColor())]) 23 | expect(view.backgroundColor) == UIColor.greenColor() 24 | } 25 | 26 | it("should remove style correctly.") { 27 | let view = UIView() 28 | view.setup(view, newStyle: [.backgroundColor(UIColor.greenColor())]) 29 | expect(view.backgroundColor) == UIColor.greenColor() 30 | view.setup(view, currentStyle:[.backgroundColor(UIColor.greenColor())], newStyle: []) 31 | expect(view.backgroundColor).to(beNil()) 32 | } 33 | } 34 | 35 | describe("BrickDescribable") { 36 | it("should apply diff to view correctly.") { 37 | // Given 38 | let superview = UIView() 39 | superview.translatesAutoresizingMaskIntoConstraints = false 40 | let view = UIView() 41 | view.translatesAutoresizingMaskIntoConstraints = false 42 | 43 | // When 44 | view.apply(Brick(name: "name").width(50).height(80), to: view, updatingStrategy: .WhenBrickChanged) 45 | 46 | superview.addSubview(view) 47 | view.setNeedsLayout() 48 | view.layoutIfNeeded() 49 | 50 | // Then 51 | expect(view.frame.width) == 50 52 | expect(view.frame.height) == 80 53 | } 54 | 55 | it("should apply diff to view correctly.") { 56 | // Given 57 | let superview = UIView() 58 | superview.translatesAutoresizingMaskIntoConstraints = false 59 | let view = UIView() 60 | view.translatesAutoresizingMaskIntoConstraints = false 61 | 62 | // When 63 | view.apply(Brick(name: "name").width(50).height(80), to: view, with: nil, updatingStrategy: .WhenBrickChanged) 64 | 65 | view.apply(Brick(name: "name").width(60).height(20), to: view, updatingStrategy: .Always) 66 | 67 | superview.addSubview(view) 68 | view.setNeedsLayout() 69 | view.layoutIfNeeded() 70 | 71 | // Then 72 | expect(view.frame.width) == 60 73 | expect(view.frame.height) == 20 74 | expect(view.constraints.count) == 2 75 | } 76 | 77 | it("should apply diff to view correctly.") { 78 | // Given 79 | let superview = UIView() 80 | superview.translatesAutoresizingMaskIntoConstraints = false 81 | let view = UIView() 82 | view.translatesAutoresizingMaskIntoConstraints = false 83 | 84 | // When 85 | view.apply(Brick(name: "name").width(50).height(80), to: view, updatingStrategy: .WhenBrickChanged) 86 | 87 | view.apply(Brick(name: "name"), to: view, updatingStrategy: .WhenBrickChanged) 88 | 89 | superview.addSubview(view) 90 | view.setNeedsLayout() 91 | view.layoutIfNeeded() 92 | 93 | // Then 94 | expect(view.frame.width) == 0 95 | expect(view.frame.height) == 0 96 | expect(view.constraints) == [] 97 | } 98 | } 99 | } 100 | } 101 | 102 | 103 | -------------------------------------------------------------------------------- /Demo/LeeGo/LeMondeNewsFeedViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LeMondeNewsFeedViewController.swift 3 | // LeeGo 4 | // 5 | // Created by Victor WANG on 27/02/16. 6 | // Copyright © 2016 LeeGo. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class LeMondeNewsFeedViewController: UIViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource { 13 | 14 | @IBOutlet weak var collectionView: UICollectionView! { 15 | didSet { 16 | for reuseId in LeMonde.cellReuseIdentifiers { 17 | collectionView.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseId) 18 | } 19 | } 20 | } 21 | 22 | private var elements = [ElementViewModel]() 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | 27 | if elements.isEmpty { 28 | let URLRequest = NSURLRequest(URL: NSURL(string: "http://api-cdn.lemonde.fr/ws/6/mobile/www/ios-phone/en_continu/index.json")!) 29 | let task = NSURLSession.sharedSession().dataTaskWithRequest(URLRequest) {data, response, error in 30 | if let data = data, 31 | let optionalValue = try? NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions(rawValue: 0)) as? Dictionary, 32 | let value = optionalValue, 33 | let elementDictionaries = value["elements"] as? Array> { 34 | self.elements = ElementViewModel.elementViewModelsWithElements(Element.elementsFromDictionaries(elementDictionaries)) 35 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 36 | self.collectionView.reloadData() 37 | }) 38 | } 39 | } 40 | 41 | task.resume() 42 | } 43 | 44 | (collectionView.collectionViewLayout as! UICollectionViewFlowLayout).estimatedItemSize = CGSizeMake(self.view.frame.width, 180) 45 | } 46 | 47 | // MARK: Collection View DataSource 48 | 49 | func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 50 | return elements.count 51 | } 52 | 53 | func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 54 | 55 | var brick = indexPath.row % 2 == 0 ? LeMonde.standard.brick() : LeMonde.featured.brick() 56 | 57 | if elements[indexPath.row].element.type == "live" { 58 | brick = LeMonde.live.brick() 59 | } 60 | 61 | let cell = collectionView.dequeueReusableCellWithReuseIdentifier(brick.name, forIndexPath: indexPath) 62 | 63 | cell.lg_configureAs(brick, dataSource: elements[indexPath.item], updatingStrategy: .Always) 64 | 65 | return cell 66 | } 67 | 68 | // MARK: Collection View Layout 69 | 70 | func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAtIndex section: Int) -> CGFloat { 71 | return 0.5 72 | } 73 | 74 | // MARK: size 75 | override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { 76 | coordinator.animateAlongsideTransition({ (context) -> Void in 77 | (self.collectionView.collectionViewLayout as! UICollectionViewFlowLayout).estimatedItemSize = CGSizeMake(self.view.frame.width, 180) 78 | self.collectionView.reloadData() 79 | }, completion: nil) 80 | 81 | super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator) 82 | } 83 | } 84 | 85 | extension UICollectionViewCell { 86 | override public func preferredLayoutAttributesFittingAttributes(layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { 87 | 88 | return lg_fittingHeightLayoutAttributes(layoutAttributes) 89 | } 90 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-LeeGoTests/Pods-LeeGoTests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | 86 | if [[ "$CONFIGURATION" == "Debug" ]]; then 87 | install_framework "Pods-LeeGoTests/Nimble.framework" 88 | install_framework "Pods-LeeGoTests/Quick.framework" 89 | fi 90 | if [[ "$CONFIGURATION" == "Release" ]]; then 91 | install_framework "Pods-LeeGoTests/Nimble.framework" 92 | install_framework "Pods-LeeGoTests/Quick.framework" 93 | fi 94 | --------------------------------------------------------------------------------