From 966d7f5be986b00eae4758d35bcb7ca69b827e7b Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:22:36 +0900 Subject: [PATCH 01/12] chore: Add Pods to .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2c22487..1de2633 100644 --- a/.gitignore +++ b/.gitignore @@ -43,7 +43,7 @@ playground.xcworkspace # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # -# Pods/ +Pods/ # Carthage # From 864b86deae3a7dbbd8dbe2b532cda0b24e14331c Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:26:26 +0900 Subject: [PATCH 02/12] chore: Create cocoapod Library --- DeviceLayout.podspec | 42 ++ DeviceLayout/Assets/.gitkeep | 0 DeviceLayout/Classes/.gitkeep | 0 DeviceLayout/Classes/ReplaceMe.swift | 0 .../DeviceLayout.xcodeproj/project.pbxproj | 586 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcschemes/DeviceLayout-Example.xcscheme | 115 ++++ .../contents.xcworkspacedata | 10 + Example/DeviceLayout/AppDelegate.swift | 46 ++ .../DeviceLayout/Base.lproj/LaunchScreen.xib | 41 ++ .../DeviceLayout/Base.lproj/Main.storyboard | 25 + .../AppIcon.appiconset/Contents.json | 38 ++ Example/DeviceLayout/Info.plist | 39 ++ Example/DeviceLayout/ViewController.swift | 24 + Example/Podfile | 14 + Example/Podfile.lock | 37 ++ Example/Tests/Info.plist | 24 + Example/Tests/Tests.swift | 50 ++ LICENSE | 12 +- README.md | 29 +- _Pods.xcodeproj | 1 + 21 files changed, 1132 insertions(+), 8 deletions(-) create mode 100644 DeviceLayout.podspec create mode 100644 DeviceLayout/Assets/.gitkeep create mode 100644 DeviceLayout/Classes/.gitkeep create mode 100644 DeviceLayout/Classes/ReplaceMe.swift create mode 100644 Example/DeviceLayout.xcodeproj/project.pbxproj create mode 100644 Example/DeviceLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Example/DeviceLayout.xcodeproj/xcshareddata/xcschemes/DeviceLayout-Example.xcscheme create mode 100644 Example/DeviceLayout.xcworkspace/contents.xcworkspacedata create mode 100644 Example/DeviceLayout/AppDelegate.swift create mode 100644 Example/DeviceLayout/Base.lproj/LaunchScreen.xib create mode 100644 Example/DeviceLayout/Base.lproj/Main.storyboard create mode 100644 Example/DeviceLayout/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Example/DeviceLayout/Info.plist create mode 100644 Example/DeviceLayout/ViewController.swift create mode 100644 Example/Podfile create mode 100644 Example/Podfile.lock create mode 100644 Example/Tests/Info.plist create mode 100644 Example/Tests/Tests.swift create mode 120000 _Pods.xcodeproj diff --git a/DeviceLayout.podspec b/DeviceLayout.podspec new file mode 100644 index 0000000..bc586cd --- /dev/null +++ b/DeviceLayout.podspec @@ -0,0 +1,42 @@ +# +# Be sure to run `pod lib lint DeviceLayout.podspec' to ensure this is a +# valid spec before submitting. +# +# Any lines starting with a # are optional, but their use is encouraged +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# + +Pod::Spec.new do |s| + s.name = 'DeviceLayout' + s.version = '0.1.0' + s.summary = 'A short description of DeviceLayout.' + +# This description is used to generate tags and improve search results. +# * Think: What does it do? Why did you write it? What is the focus? +# * Try to keep it short, snappy and to the point. +# * Write the description between the DESC delimiters below. +# * Finally, don't worry about the indent, CocoaPods strips it! + + s.description = <<-DESC +TODO: Add long description of the pod here. + DESC + + s.homepage = 'https://github.com//DeviceLayout' + # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = { 'cruisediary' => 'cruzdiary@gmail.com' } + s.source = { :git => 'https://github.com//DeviceLayout.git', :tag => s.version.to_s } + # s.social_media_url = 'https://twitter.com/' + + s.ios.deployment_target = '8.0' + + s.source_files = 'DeviceLayout/Classes/**/*' + + # s.resource_bundles = { + # 'DeviceLayout' => ['DeviceLayout/Assets/*.png'] + # } + + # s.public_header_files = 'Pod/Classes/**/*.h' + # s.frameworks = 'UIKit', 'MapKit' + # s.dependency 'AFNetworking', '~> 2.3' +end diff --git a/DeviceLayout/Assets/.gitkeep b/DeviceLayout/Assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/DeviceLayout/Classes/.gitkeep b/DeviceLayout/Classes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/DeviceLayout/Classes/ReplaceMe.swift b/DeviceLayout/Classes/ReplaceMe.swift new file mode 100644 index 0000000..e69de29 diff --git a/Example/DeviceLayout.xcodeproj/project.pbxproj b/Example/DeviceLayout.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e02f967 --- /dev/null +++ b/Example/DeviceLayout.xcodeproj/project.pbxproj @@ -0,0 +1,586 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 4515AFA4329A1F0C58461AE3 /* Pods_DeviceLayout_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C64550C7CDABD16C5B23AAB2 /* Pods_DeviceLayout_Tests.framework */; }; + 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; + 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; + 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; + 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; + 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; + 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; + 7C393419B270665DB2DFC6AF /* Pods_DeviceLayout_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EA92B048B047F81336C4465 /* Pods_DeviceLayout_Example.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 607FACC81AFB9204008FA782 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 607FACCF1AFB9204008FA782; + remoteInfo = DeviceLayout; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 125B229FF6C6A4DAE0C4D9BB /* Pods-DeviceLayout_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeviceLayout_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-DeviceLayout_Example/Pods-DeviceLayout_Example.release.xcconfig"; sourceTree = ""; }; + 1EA92B048B047F81336C4465 /* Pods_DeviceLayout_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DeviceLayout_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 607FACD01AFB9204008FA782 /* DeviceLayout_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeviceLayout_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + 607FACE51AFB9204008FA782 /* DeviceLayout_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DeviceLayout_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; + 6F8E64FA7289F9703EF21D0C /* Pods-DeviceLayout_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeviceLayout_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DeviceLayout_Example/Pods-DeviceLayout_Example.debug.xcconfig"; sourceTree = ""; }; + ACE1683887664BA04136F700 /* Pods-DeviceLayout_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeviceLayout_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-DeviceLayout_Tests/Pods-DeviceLayout_Tests.release.xcconfig"; sourceTree = ""; }; + BA7A6775BD6A986F757C6A69 /* Pods-DeviceLayout_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeviceLayout_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DeviceLayout_Tests/Pods-DeviceLayout_Tests.debug.xcconfig"; sourceTree = ""; }; + BBCC4B84872CCCF3DB3DF669 /* DeviceLayout.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = DeviceLayout.podspec; path = ../DeviceLayout.podspec; sourceTree = ""; }; + C2E45E3096D8AA24D3369AAD /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; + C64550C7CDABD16C5B23AAB2 /* Pods_DeviceLayout_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DeviceLayout_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E78F7BF1CA5ED45E9CB437BA /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 607FACCD1AFB9204008FA782 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7C393419B270665DB2DFC6AF /* Pods_DeviceLayout_Example.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 607FACE21AFB9204008FA782 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4515AFA4329A1F0C58461AE3 /* Pods_DeviceLayout_Tests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0B92D166D5335CB4EC2BC217 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1EA92B048B047F81336C4465 /* Pods_DeviceLayout_Example.framework */, + C64550C7CDABD16C5B23AAB2 /* Pods_DeviceLayout_Tests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 373278D0F14E1233EA09BD82 /* Pods */ = { + isa = PBXGroup; + children = ( + 6F8E64FA7289F9703EF21D0C /* Pods-DeviceLayout_Example.debug.xcconfig */, + 125B229FF6C6A4DAE0C4D9BB /* Pods-DeviceLayout_Example.release.xcconfig */, + BA7A6775BD6A986F757C6A69 /* Pods-DeviceLayout_Tests.debug.xcconfig */, + ACE1683887664BA04136F700 /* Pods-DeviceLayout_Tests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 607FACC71AFB9204008FA782 = { + isa = PBXGroup; + children = ( + 607FACF51AFB993E008FA782 /* Podspec Metadata */, + 607FACD21AFB9204008FA782 /* Example for DeviceLayout */, + 607FACE81AFB9204008FA782 /* Tests */, + 607FACD11AFB9204008FA782 /* Products */, + 373278D0F14E1233EA09BD82 /* Pods */, + 0B92D166D5335CB4EC2BC217 /* Frameworks */, + ); + sourceTree = ""; + }; + 607FACD11AFB9204008FA782 /* Products */ = { + isa = PBXGroup; + children = ( + 607FACD01AFB9204008FA782 /* DeviceLayout_Example.app */, + 607FACE51AFB9204008FA782 /* DeviceLayout_Tests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 607FACD21AFB9204008FA782 /* Example for DeviceLayout */ = { + isa = PBXGroup; + children = ( + 607FACD51AFB9204008FA782 /* AppDelegate.swift */, + 607FACD71AFB9204008FA782 /* ViewController.swift */, + 607FACD91AFB9204008FA782 /* Main.storyboard */, + 607FACDC1AFB9204008FA782 /* Images.xcassets */, + 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, + 607FACD31AFB9204008FA782 /* Supporting Files */, + ); + name = "Example for DeviceLayout"; + path = DeviceLayout; + sourceTree = ""; + }; + 607FACD31AFB9204008FA782 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 607FACD41AFB9204008FA782 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 607FACE81AFB9204008FA782 /* Tests */ = { + isa = PBXGroup; + children = ( + 607FACEB1AFB9204008FA782 /* Tests.swift */, + 607FACE91AFB9204008FA782 /* Supporting Files */, + ); + path = Tests; + sourceTree = ""; + }; + 607FACE91AFB9204008FA782 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 607FACEA1AFB9204008FA782 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { + isa = PBXGroup; + children = ( + BBCC4B84872CCCF3DB3DF669 /* DeviceLayout.podspec */, + E78F7BF1CA5ED45E9CB437BA /* README.md */, + C2E45E3096D8AA24D3369AAD /* LICENSE */, + ); + name = "Podspec Metadata"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 607FACCF1AFB9204008FA782 /* DeviceLayout_Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DeviceLayout_Example" */; + buildPhases = ( + 1328A70D3B7AA45AE91D2E7B /* [CP] Check Pods Manifest.lock */, + 607FACCC1AFB9204008FA782 /* Sources */, + 607FACCD1AFB9204008FA782 /* Frameworks */, + 607FACCE1AFB9204008FA782 /* Resources */, + 3D4726913FA5AF286DA2E64C /* [CP] Embed Pods Frameworks */, + F6C33B409CEFB286EE5BAB7B /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DeviceLayout_Example; + productName = DeviceLayout; + productReference = 607FACD01AFB9204008FA782 /* DeviceLayout_Example.app */; + productType = "com.apple.product-type.application"; + }; + 607FACE41AFB9204008FA782 /* DeviceLayout_Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DeviceLayout_Tests" */; + buildPhases = ( + 6033675283C736B00F4F85F4 /* [CP] Check Pods Manifest.lock */, + 607FACE11AFB9204008FA782 /* Sources */, + 607FACE21AFB9204008FA782 /* Frameworks */, + 607FACE31AFB9204008FA782 /* Resources */, + 39ECB93BD1C2D9CF9D7F4C31 /* [CP] Embed Pods Frameworks */, + 4B4A6E565FF38122BCDCF009 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + 607FACE71AFB9204008FA782 /* PBXTargetDependency */, + ); + name = DeviceLayout_Tests; + productName = Tests; + productReference = 607FACE51AFB9204008FA782 /* DeviceLayout_Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 607FACC81AFB9204008FA782 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0720; + LastUpgradeCheck = 0720; + ORGANIZATIONNAME = CocoaPods; + TargetAttributes = { + 607FACCF1AFB9204008FA782 = { + CreatedOnToolsVersion = 6.3.1; + LastSwiftMigration = 0820; + }; + 607FACE41AFB9204008FA782 = { + CreatedOnToolsVersion = 6.3.1; + LastSwiftMigration = 0820; + TestTargetID = 607FACCF1AFB9204008FA782; + }; + }; + }; + buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "DeviceLayout" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 607FACC71AFB9204008FA782; + productRefGroup = 607FACD11AFB9204008FA782 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 607FACCF1AFB9204008FA782 /* DeviceLayout_Example */, + 607FACE41AFB9204008FA782 /* DeviceLayout_Tests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 607FACCE1AFB9204008FA782 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, + 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, + 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 607FACE31AFB9204008FA782 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 1328A70D3B7AA45AE91D2E7B /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 39ECB93BD1C2D9CF9D7F4C31 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DeviceLayout_Tests/Pods-DeviceLayout_Tests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 3D4726913FA5AF286DA2E64C /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DeviceLayout_Example/Pods-DeviceLayout_Example-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 4B4A6E565FF38122BCDCF009 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DeviceLayout_Tests/Pods-DeviceLayout_Tests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 6033675283C736B00F4F85F4 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + F6C33B409CEFB286EE5BAB7B /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DeviceLayout_Example/Pods-DeviceLayout_Example-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 607FACCC1AFB9204008FA782 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, + 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 607FACE11AFB9204008FA782 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 607FACCF1AFB9204008FA782 /* DeviceLayout_Example */; + targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 607FACD91AFB9204008FA782 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 607FACDA1AFB9204008FA782 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + 607FACDF1AFB9204008FA782 /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 607FACED1AFB9204008FA782 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 607FACEE1AFB9204008FA782 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 607FACF01AFB9204008FA782 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6F8E64FA7289F9703EF21D0C /* Pods-DeviceLayout_Example.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = DeviceLayout/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MODULE_NAME = ExampleApp; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 607FACF11AFB9204008FA782 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 125B229FF6C6A4DAE0C4D9BB /* Pods-DeviceLayout_Example.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = DeviceLayout/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MODULE_NAME = ExampleApp; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 607FACF31AFB9204008FA782 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BA7A6775BD6A986F757C6A69 /* Pods-DeviceLayout_Tests.debug.xcconfig */; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 607FACF41AFB9204008FA782 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = ACE1683887664BA04136F700 /* Pods-DeviceLayout_Tests.release.xcconfig */; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "DeviceLayout" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 607FACED1AFB9204008FA782 /* Debug */, + 607FACEE1AFB9204008FA782 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DeviceLayout_Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 607FACF01AFB9204008FA782 /* Debug */, + 607FACF11AFB9204008FA782 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DeviceLayout_Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 607FACF31AFB9204008FA782 /* Debug */, + 607FACF41AFB9204008FA782 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 607FACC81AFB9204008FA782 /* Project object */; +} diff --git a/Example/DeviceLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/DeviceLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..be0c690 --- /dev/null +++ b/Example/DeviceLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/DeviceLayout.xcodeproj/xcshareddata/xcschemes/DeviceLayout-Example.xcscheme b/Example/DeviceLayout.xcodeproj/xcshareddata/xcschemes/DeviceLayout-Example.xcscheme new file mode 100644 index 0000000..8bf64ca --- /dev/null +++ b/Example/DeviceLayout.xcodeproj/xcshareddata/xcschemes/DeviceLayout-Example.xcscheme @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/DeviceLayout.xcworkspace/contents.xcworkspacedata b/Example/DeviceLayout.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..958e6c1 --- /dev/null +++ b/Example/DeviceLayout.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Example/DeviceLayout/AppDelegate.swift b/Example/DeviceLayout/AppDelegate.swift new file mode 100644 index 0000000..975d6d6 --- /dev/null +++ b/Example/DeviceLayout/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// DeviceLayout +// +// Created by cruisediary on 12/15/2016. +// Copyright (c) 2016 cruisediary. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // 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. + // 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. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // 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. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // 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. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // 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. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Example/DeviceLayout/Base.lproj/LaunchScreen.xib b/Example/DeviceLayout/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..035ded1 --- /dev/null +++ b/Example/DeviceLayout/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/DeviceLayout/Base.lproj/Main.storyboard b/Example/DeviceLayout/Base.lproj/Main.storyboard new file mode 100644 index 0000000..52ea29e --- /dev/null +++ b/Example/DeviceLayout/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/DeviceLayout/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/DeviceLayout/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d3942e9 --- /dev/null +++ b/Example/DeviceLayout/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/Example/DeviceLayout/Info.plist b/Example/DeviceLayout/Info.plist new file mode 100644 index 0000000..eb18faa --- /dev/null +++ b/Example/DeviceLayout/Info.plist @@ -0,0 +1,39 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + + + diff --git a/Example/DeviceLayout/ViewController.swift b/Example/DeviceLayout/ViewController.swift new file mode 100644 index 0000000..b07c64d --- /dev/null +++ b/Example/DeviceLayout/ViewController.swift @@ -0,0 +1,24 @@ +// +// ViewController.swift +// DeviceLayout +// +// Created by cruisediary on 12/15/2016. +// Copyright (c) 2016 cruisediary. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + +} + diff --git a/Example/Podfile b/Example/Podfile new file mode 100644 index 0000000..09dcf37 --- /dev/null +++ b/Example/Podfile @@ -0,0 +1,14 @@ +use_frameworks! + +target 'DeviceLayout_Example' do + pod 'DeviceLayout', :path => '../' + + target 'DeviceLayout_Tests' do + inherit! :search_paths + + pod 'Quick', '~> 0.8' + pod 'Nimble', '~> 3.0' + pod 'FBSnapshotTestCase' + pod 'Nimble-Snapshots' + end +end diff --git a/Example/Podfile.lock b/Example/Podfile.lock new file mode 100644 index 0000000..d1017dc --- /dev/null +++ b/Example/Podfile.lock @@ -0,0 +1,37 @@ +PODS: + - DeviceLayout (0.1.0) + - FBSnapshotTestCase (2.1.4): + - FBSnapshotTestCase/SwiftSupport (= 2.1.4) + - FBSnapshotTestCase/Core (2.1.4) + - FBSnapshotTestCase/SwiftSupport (2.1.4): + - FBSnapshotTestCase/Core + - Nimble (3.2.0) + - Nimble-Snapshots (4.4.0): + - Nimble-Snapshots/Core (= 4.4.0) + - Nimble-Snapshots/Core (4.4.0): + - FBSnapshotTestCase (~> 2.0) + - Nimble + - Quick + - Quick (0.10.0) + +DEPENDENCIES: + - DeviceLayout (from `../`) + - FBSnapshotTestCase + - Nimble (~> 3.0) + - Nimble-Snapshots + - Quick (~> 0.8) + +EXTERNAL SOURCES: + DeviceLayout: + :path: "../" + +SPEC CHECKSUMS: + DeviceLayout: be6f2212021b1157322675b50db26ed65936ac9d + FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a' + Nimble: 703854335d181df169bbca9c97117b5cf8c47c1d + Nimble-Snapshots: e743439f26c2fa99d8f7e0d7c01c99bcb40aa6f2 + Quick: 5d290df1c69d5ee2f0729956dcf0fd9a30447eaa + +PODFILE CHECKSUM: f98899e74bdd87409079eba1f2355d68c3ae6807 + +COCOAPODS: 1.1.1 diff --git a/Example/Tests/Info.plist b/Example/Tests/Info.plist new file mode 100644 index 0000000..ba72822 --- /dev/null +++ b/Example/Tests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Example/Tests/Tests.swift b/Example/Tests/Tests.swift new file mode 100644 index 0000000..71175cc --- /dev/null +++ b/Example/Tests/Tests.swift @@ -0,0 +1,50 @@ +// https://github.com/Quick/Quick + +import Quick +import Nimble +import DeviceLayout + +class TableOfContentsSpec: QuickSpec { + override func spec() { + describe("these will fail") { + + it("can do maths") { + expect(1) == 2 + } + + it("can read") { + expect("number") == "string" + } + + it("will eventually fail") { + expect("time").toEventually( equal("done") ) + } + + context("these will pass") { + + it("can do maths") { + expect(23) == 23 + } + + it("can read") { + expect("🐮") == "🐮" + } + + it("will eventually pass") { + var time = "passing" + + dispatch_async(dispatch_get_main_queue()) { + time = "done" + } + + waitUntil { done in + NSThread.sleepForTimeInterval(0.5) + expect(time) == "done" + + done() + } + } + } + } + } +} diff --git a/LICENSE b/LICENSE index c1ff3d5..8553146 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,4 @@ -MIT License - -Copyright (c) 2016 SwiftyCruz +Copyright (c) 2016 cruisediary Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -9,13 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index 154f796..f21f96b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,29 @@ # DeviceLayout -AutoLayout can be set differently for each device + +[![CI Status](http://img.shields.io/travis/cruisediary/DeviceLayout.svg?style=flat)](https://travis-ci.org/cruisediary/DeviceLayout) +[![Version](https://img.shields.io/cocoapods/v/DeviceLayout.svg?style=flat)](http://cocoapods.org/pods/DeviceLayout) +[![License](https://img.shields.io/cocoapods/l/DeviceLayout.svg?style=flat)](http://cocoapods.org/pods/DeviceLayout) +[![Platform](https://img.shields.io/cocoapods/p/DeviceLayout.svg?style=flat)](http://cocoapods.org/pods/DeviceLayout) + +## Example + +To run the example project, clone the repo, and run `pod install` from the Example directory first. + +## Requirements + +## Installation + +DeviceLayout is available through [CocoaPods](http://cocoapods.org). To install +it, simply add the following line to your Podfile: + +```ruby +pod "DeviceLayout" +``` + +## Author + +cruisediary, cruzdiary@gmail.com + +## License + +DeviceLayout is available under the MIT license. See the LICENSE file for more info. diff --git a/_Pods.xcodeproj b/_Pods.xcodeproj new file mode 120000 index 0000000..3c5a8e7 --- /dev/null +++ b/_Pods.xcodeproj @@ -0,0 +1 @@ +Example/Pods/Pods.xcodeproj \ No newline at end of file From 5d12b974c41efb6bbe2f563e2b86616d1daecbe1 Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:26:55 +0900 Subject: [PATCH 03/12] chore: Add .swift-version 3.0 --- .swift-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .swift-version diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..9f55b2c --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +3.0 From 04348de866742adf91cf378dcf3e744fec7a24df Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:30:02 +0900 Subject: [PATCH 04/12] chore: Update podspec --- DeviceLayout.podspec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DeviceLayout.podspec b/DeviceLayout.podspec index bc586cd..5e3595a 100644 --- a/DeviceLayout.podspec +++ b/DeviceLayout.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = 'DeviceLayout' s.version = '0.1.0' - s.summary = 'A short description of DeviceLayout.' + s.summary = 'Auto layout can be set differently for each device.' # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? @@ -17,7 +17,7 @@ Pod::Spec.new do |s| # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! - s.description = <<-DESC + s.description = Auto layout can be set differently for each device. TODO: Add long description of the pod here. DESC @@ -25,13 +25,13 @@ TODO: Add long description of the pod here. # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'cruisediary' => 'cruzdiary@gmail.com' } - s.source = { :git => 'https://github.com//DeviceLayout.git', :tag => s.version.to_s } + s.source = { :git => 'https://github.com/cruisediary/DeviceLayout.git', :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/' s.ios.deployment_target = '8.0' s.source_files = 'DeviceLayout/Classes/**/*' - + s.dependency 'Device', '~> 2.0.0' # s.resource_bundles = { # 'DeviceLayout' => ['DeviceLayout/Assets/*.png'] # } From 96a00a7adcf5bff42badb5e26c28f916c7f693cc Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:30:30 +0900 Subject: [PATCH 05/12] chore: update Podfile to use swift 3 --- Example/Podfile | 12 ++++++++++-- Example/Podfile.lock | 14 +++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Example/Podfile b/Example/Podfile index 09dcf37..daeafee 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -6,9 +6,17 @@ target 'DeviceLayout_Example' do target 'DeviceLayout_Tests' do inherit! :search_paths - pod 'Quick', '~> 0.8' - pod 'Nimble', '~> 3.0' + pod 'Quick', '~> 1.0' + pod 'Nimble', '~> 5.0' pod 'FBSnapshotTestCase' pod 'Nimble-Snapshots' end end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['SWIFT_VERSION'] = '3.0' + end + end +end diff --git a/Example/Podfile.lock b/Example/Podfile.lock index d1017dc..63ba2bb 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -5,21 +5,21 @@ PODS: - FBSnapshotTestCase/Core (2.1.4) - FBSnapshotTestCase/SwiftSupport (2.1.4): - FBSnapshotTestCase/Core - - Nimble (3.2.0) + - Nimble (5.1.1) - Nimble-Snapshots (4.4.0): - Nimble-Snapshots/Core (= 4.4.0) - Nimble-Snapshots/Core (4.4.0): - FBSnapshotTestCase (~> 2.0) - Nimble - Quick - - Quick (0.10.0) + - Quick (1.0.0) DEPENDENCIES: - DeviceLayout (from `../`) - FBSnapshotTestCase - - Nimble (~> 3.0) + - Nimble (~> 5.0) - Nimble-Snapshots - - Quick (~> 0.8) + - Quick (~> 1.0) EXTERNAL SOURCES: DeviceLayout: @@ -28,10 +28,10 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: DeviceLayout: be6f2212021b1157322675b50db26ed65936ac9d FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a' - Nimble: 703854335d181df169bbca9c97117b5cf8c47c1d + Nimble: 415e3aa3267e7bc2c96b05fa814ddea7bb686a29 Nimble-Snapshots: e743439f26c2fa99d8f7e0d7c01c99bcb40aa6f2 - Quick: 5d290df1c69d5ee2f0729956dcf0fd9a30447eaa + Quick: 8024e4a47e6cc03a9d5245ef0948264fc6d27cff -PODFILE CHECKSUM: f98899e74bdd87409079eba1f2355d68c3ae6807 +PODFILE CHECKSUM: 5f47d9c86c61470a794798d080c30f99eed0c540 COCOAPODS: 1.1.1 From effcf69fe2735884cdac3f034ff7d3fb6b7c5527 Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:32:08 +0900 Subject: [PATCH 06/12] delete: default test file --- .../DeviceLayout.xcodeproj/project.pbxproj | 4 -- Example/Tests/Tests.swift | 50 ------------------- 2 files changed, 54 deletions(-) delete mode 100644 Example/Tests/Tests.swift diff --git a/Example/DeviceLayout.xcodeproj/project.pbxproj b/Example/DeviceLayout.xcodeproj/project.pbxproj index e02f967..43a12d4 100644 --- a/Example/DeviceLayout.xcodeproj/project.pbxproj +++ b/Example/DeviceLayout.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; - 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; 7C393419B270665DB2DFC6AF /* Pods_DeviceLayout_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EA92B048B047F81336C4465 /* Pods_DeviceLayout_Example.framework */; }; /* End PBXBuildFile section */ @@ -39,7 +38,6 @@ 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 607FACE51AFB9204008FA782 /* DeviceLayout_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DeviceLayout_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 6F8E64FA7289F9703EF21D0C /* Pods-DeviceLayout_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeviceLayout_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DeviceLayout_Example/Pods-DeviceLayout_Example.debug.xcconfig"; sourceTree = ""; }; ACE1683887664BA04136F700 /* Pods-DeviceLayout_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeviceLayout_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-DeviceLayout_Tests/Pods-DeviceLayout_Tests.release.xcconfig"; sourceTree = ""; }; BA7A6775BD6A986F757C6A69 /* Pods-DeviceLayout_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeviceLayout_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DeviceLayout_Tests/Pods-DeviceLayout_Tests.debug.xcconfig"; sourceTree = ""; }; @@ -135,7 +133,6 @@ 607FACE81AFB9204008FA782 /* Tests */ = { isa = PBXGroup; children = ( - 607FACEB1AFB9204008FA782 /* Tests.swift */, 607FACE91AFB9204008FA782 /* Supporting Files */, ); path = Tests; @@ -370,7 +367,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Example/Tests/Tests.swift b/Example/Tests/Tests.swift deleted file mode 100644 index 71175cc..0000000 --- a/Example/Tests/Tests.swift +++ /dev/null @@ -1,50 +0,0 @@ -// https://github.com/Quick/Quick - -import Quick -import Nimble -import DeviceLayout - -class TableOfContentsSpec: QuickSpec { - override func spec() { - describe("these will fail") { - - it("can do maths") { - expect(1) == 2 - } - - it("can read") { - expect("number") == "string" - } - - it("will eventually fail") { - expect("time").toEventually( equal("done") ) - } - - context("these will pass") { - - it("can do maths") { - expect(23) == 23 - } - - it("can read") { - expect("🐮") == "🐮" - } - - it("will eventually pass") { - var time = "passing" - - dispatch_async(dispatch_get_main_queue()) { - time = "done" - } - - waitUntil { done in - NSThread.sleepForTimeInterval(0.5) - expect(time) == "done" - - done() - } - } - } - } - } -} From 3b6fa61a3c9248f7a52d771bda1f84fea3b0f27b Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:33:08 +0900 Subject: [PATCH 07/12] chore: Add .gitattributes --- Example/.gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 Example/.gitattributes diff --git a/Example/.gitattributes b/Example/.gitattributes new file mode 100644 index 0000000..a198d45 --- /dev/null +++ b/Example/.gitattributes @@ -0,0 +1 @@ +*.pbxproj binary merge=union \ No newline at end of file From e849ea9ab11b8bd35477c2c2c74b4ce410969431 Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:36:46 +0900 Subject: [PATCH 08/12] style: remove `TODO~ DESC` from podspec --- DeviceLayout.podspec | 5 +---- Example/Podfile.lock | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DeviceLayout.podspec b/DeviceLayout.podspec index 5e3595a..5a887a2 100644 --- a/DeviceLayout.podspec +++ b/DeviceLayout.podspec @@ -17,10 +17,7 @@ Pod::Spec.new do |s| # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! - s.description = Auto layout can be set differently for each device. -TODO: Add long description of the pod here. - DESC - + s.description = 'Auto layout can be set differently for each device.' s.homepage = 'https://github.com//DeviceLayout' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 63ba2bb..da6786c 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,7 @@ PODS: - - DeviceLayout (0.1.0) + - Device (2.0.0) + - DeviceLayout (0.1.0): + - Device (~> 2.0.0) - FBSnapshotTestCase (2.1.4): - FBSnapshotTestCase/SwiftSupport (= 2.1.4) - FBSnapshotTestCase/Core (2.1.4) @@ -26,7 +28,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - DeviceLayout: be6f2212021b1157322675b50db26ed65936ac9d + Device: d18c6b7f5c38f3be11dd05c4f24a091bb7061b36 + DeviceLayout: 5c9eb5be7b22358b8cfb38896ee0d9cc830af333 FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a' Nimble: 415e3aa3267e7bc2c96b05fa814ddea7bb686a29 Nimble-Snapshots: e743439f26c2fa99d8f7e0d7c01c99bcb40aa6f2 From e1592d531309a59a91a3152ffea04e63edf8a955 Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 16:56:39 +0900 Subject: [PATCH 09/12] fix: Fix lib link error, set hompage username, change description --- DeviceLayout.podspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DeviceLayout.podspec b/DeviceLayout.podspec index 5a887a2..e768266 100644 --- a/DeviceLayout.podspec +++ b/DeviceLayout.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = 'DeviceLayout' s.version = '0.1.0' - s.summary = 'Auto layout can be set differently for each device.' + s.summary = 'Auto Layout can be set differently for each device.' # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? @@ -17,8 +17,8 @@ Pod::Spec.new do |s| # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! - s.description = 'Auto layout can be set differently for each device.' - s.homepage = 'https://github.com//DeviceLayout' + s.description = 'Auto Layout can be set differently for each device. use IBInspectable' + s.homepage = 'https://github.com/cruisediary/DeviceLayout' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'cruisediary' => 'cruzdiary@gmail.com' } From b07b97b6d68e8b2e542ed854be4b24e0dc866e37 Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 17:53:21 +0900 Subject: [PATCH 10/12] test(unittest): Add DeviceLayoutConstraint unittset to set constant --- DeviceLayout.podspec | 2 +- DeviceLayout/Classes/.gitkeep | 0 DeviceLayout/Classes/ReplaceMe.swift | 0 Example/.Podfile.swp | Bin 0 -> 12288 bytes .../DeviceLayout.xcodeproj/project.pbxproj | 22 ++++++- .../xcschemes/DeviceLayout-Example.xcscheme | 2 +- .../DeviceLayout/Base.lproj/Main.storyboard | 17 +++-- Example/Podfile | 1 + Example/Podfile.lock | 4 +- .../Tests/DeviceLayoutConstraintTests.swift | 62 ++++++++++++++++++ .../DeviceLayout_Tests-Bridging-Header.h | 4 ++ 11 files changed, 103 insertions(+), 11 deletions(-) delete mode 100644 DeviceLayout/Classes/.gitkeep delete mode 100644 DeviceLayout/Classes/ReplaceMe.swift create mode 100644 Example/.Podfile.swp create mode 100644 Example/Tests/DeviceLayoutConstraintTests.swift create mode 100644 Example/Tests/DeviceLayout_Tests-Bridging-Header.h diff --git a/DeviceLayout.podspec b/DeviceLayout.podspec index e768266..2f1880c 100644 --- a/DeviceLayout.podspec +++ b/DeviceLayout.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '8.0' - s.source_files = 'DeviceLayout/Classes/**/*' + s.source_files = 'Sources/**/*' s.dependency 'Device', '~> 2.0.0' # s.resource_bundles = { # 'DeviceLayout' => ['DeviceLayout/Assets/*.png'] diff --git a/DeviceLayout/Classes/.gitkeep b/DeviceLayout/Classes/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/DeviceLayout/Classes/ReplaceMe.swift b/DeviceLayout/Classes/ReplaceMe.swift deleted file mode 100644 index e69de29..0000000 diff --git a/Example/.Podfile.swp b/Example/.Podfile.swp new file mode 100644 index 0000000000000000000000000000000000000000..d66234b8d2e266de0297ce3c951ae6dadaedb6b3 GIT binary patch literal 12288 zcmeI2Pixdb7{;gGL|dzZ-egt}0kO%}Dng+>^q(%cwe7Z55Dl}*?C!YPOvp^s%2F?a zU%(Hcc=uy?u!o-f40`hHn@x6I#ELyh;Td=`WM-ac=KbA5rdi#s)%hLw7Na)J*woI} zqh;sm>5p~Bf;4*-Dv|ExbAM@d5iDulo!LmW8|gqqN37i+1$rww$a*ri#=EQRy{zf2 z$mc4M_r;#hthf47^pZ$=8#-*MNFEV~VGsa;V-c8Sb2n$Jx#il`3cq+^=U8qm1_2NN z0T2KI5C8!X009s<*#vAd!Cq4dr^+%em;JLxlgev;~EGO%uuGUg}-`Yh4L`lV?QH45l6HeLqBac5oinvtAo z#3C^rZB2f}!Nl6qaBN!|yDW?xO%)#J26y%s`R!p@1K0Rfby_f=2;1Qci`;Qtuc&^o zY%^0qw+xug18CR0(vD1(t?+pxMH+Pc+-+#8D2+Sg>3)7J<4}dU`5!j_V@P?MzKF?; P^joRu$rn29nhN^~wh`8_ literal 0 HcmV?d00001 diff --git a/Example/DeviceLayout.xcodeproj/project.pbxproj b/Example/DeviceLayout.xcodeproj/project.pbxproj index 43a12d4..efc569b 100644 --- a/Example/DeviceLayout.xcodeproj/project.pbxproj +++ b/Example/DeviceLayout.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 4515AFA4329A1F0C58461AE3 /* Pods_DeviceLayout_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C64550C7CDABD16C5B23AAB2 /* Pods_DeviceLayout_Tests.framework */; }; + 4CB36FA11E028A980054B259 /* DeviceLayoutConstraintTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CB36FA01E028A980054B259 /* DeviceLayoutConstraintTests.swift */; }; 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; @@ -29,6 +30,8 @@ /* Begin PBXFileReference section */ 125B229FF6C6A4DAE0C4D9BB /* Pods-DeviceLayout_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeviceLayout_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-DeviceLayout_Example/Pods-DeviceLayout_Example.release.xcconfig"; sourceTree = ""; }; 1EA92B048B047F81336C4465 /* Pods_DeviceLayout_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DeviceLayout_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4CB36F9F1E028A970054B259 /* DeviceLayout_Tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DeviceLayout_Tests-Bridging-Header.h"; sourceTree = ""; }; + 4CB36FA01E028A980054B259 /* DeviceLayoutConstraintTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceLayoutConstraintTests.swift; sourceTree = ""; }; 607FACD01AFB9204008FA782 /* DeviceLayout_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeviceLayout_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -134,6 +137,8 @@ isa = PBXGroup; children = ( 607FACE91AFB9204008FA782 /* Supporting Files */, + 4CB36FA01E028A980054B259 /* DeviceLayoutConstraintTests.swift */, + 4CB36F9F1E028A970054B259 /* DeviceLayout_Tests-Bridging-Header.h */, ); path = Tests; sourceTree = ""; @@ -207,7 +212,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0820; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { @@ -367,6 +372,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 4CB36FA11E028A980054B259 /* DeviceLayoutConstraintTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -413,8 +419,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -458,8 +466,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -478,6 +488,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -486,6 +497,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 6F8E64FA7289F9703EF21D0C /* Pods-DeviceLayout_Example.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = DeviceLayout/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -500,6 +512,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 125B229FF6C6A4DAE0C4D9BB /* Pods-DeviceLayout_Example.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = DeviceLayout/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -514,6 +527,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = BA7A6775BD6A986F757C6A69 /* Pods-DeviceLayout_Tests.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -526,6 +541,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Tests/DeviceLayout_Tests-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; }; name = Debug; @@ -534,6 +551,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = ACE1683887664BA04136F700 /* Pods-DeviceLayout_Tests.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -542,6 +561,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Tests/DeviceLayout_Tests-Bridging-Header.h"; SWIFT_VERSION = 3.0; }; name = Release; diff --git a/Example/DeviceLayout.xcodeproj/xcshareddata/xcschemes/DeviceLayout-Example.xcscheme b/Example/DeviceLayout.xcodeproj/xcshareddata/xcschemes/DeviceLayout-Example.xcscheme index 8bf64ca..13b22cd 100644 --- a/Example/DeviceLayout.xcodeproj/xcshareddata/xcschemes/DeviceLayout-Example.xcscheme +++ b/Example/DeviceLayout.xcodeproj/xcshareddata/xcschemes/DeviceLayout-Example.xcscheme @@ -1,6 +1,6 @@ - + + + + + - + + + - + - + - + diff --git a/Example/Podfile b/Example/Podfile index daeafee..783b8f9 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -7,6 +7,7 @@ target 'DeviceLayout_Example' do inherit! :search_paths pod 'Quick', '~> 1.0' + pod 'DeviceLayout', :path => '../' pod 'Nimble', '~> 5.0' pod 'FBSnapshotTestCase' pod 'Nimble-Snapshots' diff --git a/Example/Podfile.lock b/Example/Podfile.lock index da6786c..bd2af06 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -29,12 +29,12 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Device: d18c6b7f5c38f3be11dd05c4f24a091bb7061b36 - DeviceLayout: 5c9eb5be7b22358b8cfb38896ee0d9cc830af333 + DeviceLayout: 490a671996f816a2816e9e727913bb8185891617 FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a' Nimble: 415e3aa3267e7bc2c96b05fa814ddea7bb686a29 Nimble-Snapshots: e743439f26c2fa99d8f7e0d7c01c99bcb40aa6f2 Quick: 8024e4a47e6cc03a9d5245ef0948264fc6d27cff -PODFILE CHECKSUM: 5f47d9c86c61470a794798d080c30f99eed0c540 +PODFILE CHECKSUM: 2d5ad51aeb98b52d771e5bda79717c42fe49fc7a COCOAPODS: 1.1.1 diff --git a/Example/Tests/DeviceLayoutConstraintTests.swift b/Example/Tests/DeviceLayoutConstraintTests.swift new file mode 100644 index 0000000..16ee2a1 --- /dev/null +++ b/Example/Tests/DeviceLayoutConstraintTests.swift @@ -0,0 +1,62 @@ +// +// DeviceLayoutConstraintTests.swift +// DeviceLayout +// +// Created by CruzDiary on 15/12/2016. +// Copyright © 2016 CocoaPods. All rights reserved. +// + +import XCTest + +import Quick +import Nimble + +@testable import DeviceLayout + +class DeviceLayoutConstraintTests: QuickSpec { + + struct Expected { + struct Constant { + static let inch3_5: CGFloat = 30 + static let inch4: CGFloat = 50 + static let inch4_7: CGFloat = 80 + static let inch5_5: CGFloat = 100 + static let inch7_9: CGFloat = 150 + static let inch9_7: CGFloat = 200 + static let inch12_9: CGFloat = 250 + } + } + + override func spec() { + var sut: DeviceLayoutConstraint! + let defaultConstant: CGFloat = 30 + + beforeEach { + sut = DeviceLayoutConstraint() + sut.constant = defaultConstant + } + + describe("DeviceLayoutConstraint") { + context("when use iPhone6") { + beforeEach { + sut.deviceSize = .screen5_5Inch + sut.inch5_5 = Expected.Constant.inch5_5 + } + + it("constant should be equal to \(Expected.Constant.inch5_5)") { + expect(sut.constant).to(equal(Expected.Constant.inch5_5)) + } + + context("when update iPhone4_7 inch constant") { + beforeEach { + sut.inch4_7 = Expected.Constant.inch4_7 + } + + it("constant should be equal to inch5_5") { + expect(sut.constant).to(equal(Expected.Constant.inch5_5)) + } + } + } + } + } +} diff --git a/Example/Tests/DeviceLayout_Tests-Bridging-Header.h b/Example/Tests/DeviceLayout_Tests-Bridging-Header.h new file mode 100644 index 0000000..1b2cb5d --- /dev/null +++ b/Example/Tests/DeviceLayout_Tests-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + From 41d3fb79b7e11f5091ded4fa22467591c18decd5 Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 18:01:58 +0900 Subject: [PATCH 11/12] feature: Add DeviceLayoutConstraint --- Sources/DeviceLayoutConstraint.swift | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Sources/DeviceLayoutConstraint.swift diff --git a/Sources/DeviceLayoutConstraint.swift b/Sources/DeviceLayoutConstraint.swift new file mode 100644 index 0000000..b84f0ea --- /dev/null +++ b/Sources/DeviceLayoutConstraint.swift @@ -0,0 +1,36 @@ +// +// DeviceLayout.swift +// DeviceLayout +// +// Created by CruzDiary on 15/12/2016. +// Copyright © 2016 CocoaPods. All rights reserved. +// + +import UIKit + +import Device + +class DeviceLayoutConstraint: NSLayoutConstraint { + + open var deviceSize: Size = Device.size() + + @IBInspectable var inch3_5: CGFloat = 0.0 { didSet { updateConstant(size: .screen3_5Inch, constant: inch3_5)}} + @IBInspectable var inch4: CGFloat = 0.0 { didSet { updateConstant(size: .screen4Inch, constant: inch4)}} + @IBInspectable var inch4_7: CGFloat = 0.0 { didSet { updateConstant(size: .screen4_7Inch, constant: inch4_7)}} + @IBInspectable var inch5_5: CGFloat = 0.0 { didSet { updateConstant(size: .screen5_5Inch, constant: inch5_5)}} + @IBInspectable var inch7_9: CGFloat = 0.0 { didSet { updateConstant(size: .screen7_9Inch, constant: inch7_9)}} + @IBInspectable var inch9_7: CGFloat = 0.0 { didSet { updateConstant(size: .screen9_7Inch, constant: inch9_7)}} + @IBInspectable var inch12_9: CGFloat = 0.0 { didSet { updateConstant(size: .screen12_9Inch, constant: inch12_9)}} + + fileprivate func updateConstant(size: Size, constant: CGFloat) { + if size == self.deviceSize { + self.constant = constant + layoutIfNeeded() + } + } + + open func layoutIfNeeded() { + self.firstItem.layoutIfNeeded() + self.secondItem?.layoutIfNeeded() + } +} From 99b58e7695a7bc7264be2db47bf3672ba5df08e6 Mon Sep 17 00:00:00 2001 From: cruisediary Date: Thu, 15 Dec 2016 18:03:49 +0900 Subject: [PATCH 12/12] test(unittest): Add test with spy when set constant per deviceSize whether layoutIfNeeded called once --- Example/.Podfile.swp | Bin 12288 -> 0 bytes .../Tests/DeviceLayoutConstraintTests.swift | 33 ++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) delete mode 100644 Example/.Podfile.swp diff --git a/Example/.Podfile.swp b/Example/.Podfile.swp deleted file mode 100644 index d66234b8d2e266de0297ce3c951ae6dadaedb6b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2Pixdb7{;gGL|dzZ-egt}0kO%}Dng+>^q(%cwe7Z55Dl}*?C!YPOvp^s%2F?a zU%(Hcc=uy?u!o-f40`hHn@x6I#ELyh;Td=`WM-ac=KbA5rdi#s)%hLw7Na)J*woI} zqh;sm>5p~Bf;4*-Dv|ExbAM@d5iDulo!LmW8|gqqN37i+1$rww$a*ri#=EQRy{zf2 z$mc4M_r;#hthf47^pZ$=8#-*MNFEV~VGsa;V-c8Sb2n$Jx#il`3cq+^=U8qm1_2NN z0T2KI5C8!X009s<*#vAd!Cq4dr^+%em;JLxlgev;~EGO%uuGUg}-`Yh4L`lV?QH45l6HeLqBac5oinvtAo z#3C^rZB2f}!Nl6qaBN!|yDW?xO%)#J26y%s`R!p@1K0Rfby_f=2;1Qci`;Qtuc&^o zY%^0qw+xug18CR0(vD1(t?+pxMH+Pc+-+#8D2+Sg>3)7J<4}dU`5!j_V@P?MzKF?; P^joRu$rn29nhN^~wh`8_ diff --git a/Example/Tests/DeviceLayoutConstraintTests.swift b/Example/Tests/DeviceLayoutConstraintTests.swift index 16ee2a1..b234eb0 100644 --- a/Example/Tests/DeviceLayoutConstraintTests.swift +++ b/Example/Tests/DeviceLayoutConstraintTests.swift @@ -28,11 +28,11 @@ class DeviceLayoutConstraintTests: QuickSpec { } override func spec() { - var sut: DeviceLayoutConstraint! + var sut: DeviceLayoutConstraintSpy! let defaultConstant: CGFloat = 30 beforeEach { - sut = DeviceLayoutConstraint() + sut = DeviceLayoutConstraintSpy() sut.constant = defaultConstant } @@ -57,6 +57,35 @@ class DeviceLayoutConstraintTests: QuickSpec { } } } + + context("when deviceSize is 4inch device") { + beforeEach { + sut.deviceSize = .screen4Inch + } + + context("when set constant per deviceSize") { + beforeEach { + sut.inch3_5 = Expected.Constant.inch3_5 + sut.inch4 = Expected.Constant.inch4 + sut.inch4_7 = Expected.Constant.inch4_7 + sut.inch5_5 = Expected.Constant.inch5_5 + sut.inch7_9 = Expected.Constant.inch7_9 + sut.inch9_7 = Expected.Constant.inch9_7 + sut.inch12_9 = Expected.Constant.inch12_9 + } + + it("layoutIfNeeded should be called ONLY once") { + expect(sut.layoutIfNeededCalledCount).to(equal(1)) + } + } + } } } } + +class DeviceLayoutConstraintSpy: DeviceLayoutConstraint { + var layoutIfNeededCalledCount: Int = 0 + override open func layoutIfNeeded() { + layoutIfNeededCalledCount += 1 + } +}