diff --git a/examples/ASDK+HeroBasic/Podfile b/examples/ASDK+HeroBasic/Podfile new file mode 100644 index 000000000..d5f7c0e83 --- /dev/null +++ b/examples/ASDK+HeroBasic/Podfile @@ -0,0 +1,8 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' + +use_frameworks! +target 'Sample' do + pod 'Texture', :path => '../..' + pod 'Hero' +end diff --git a/examples/ASDK+HeroBasic/Sample.xcodeproj/project.pbxproj b/examples/ASDK+HeroBasic/Sample.xcodeproj/project.pbxproj new file mode 100644 index 000000000..b0e10630c --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample.xcodeproj/project.pbxproj @@ -0,0 +1,384 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 2D406B2A1E9E154F003971FA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D406B291E9E154F003971FA /* AppDelegate.swift */; }; + 2D406B2C1E9E154F003971FA /* NodeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D406B2B1E9E154F003971FA /* NodeController.swift */; }; + 2D406B311E9E154F003971FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2D406B301E9E154F003971FA /* Assets.xcassets */; }; + 2D406B341E9E154F003971FA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2D406B321E9E154F003971FA /* LaunchScreen.storyboard */; }; + 2D406B3C1E9E1DD7003971FA /* CityGuideNodeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D406B3B1E9E1DD7003971FA /* CityGuideNodeController.swift */; }; + 2D406B3E1E9E2F06003971FA /* ImageCellNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D406B3D1E9E2F06003971FA /* ImageCellNode.swift */; }; + B5E0191FC1352099684AC5F8 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ECB323B254D140F85EAB44D /* Pods_Sample.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1ECB323B254D140F85EAB44D /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D406B261E9E154F003971FA /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D406B291E9E154F003971FA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 2D406B2B1E9E154F003971FA /* NodeController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeController.swift; sourceTree = ""; }; + 2D406B301E9E154F003971FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2D406B331E9E154F003971FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 2D406B351E9E154F003971FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2D406B3B1E9E1DD7003971FA /* CityGuideNodeController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CityGuideNodeController.swift; sourceTree = ""; }; + 2D406B3D1E9E2F06003971FA /* ImageCellNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCellNode.swift; sourceTree = ""; }; + 6EBE5401BB9A4852372339F7 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; + E29468E54B5A1F870938978F /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2D406B231E9E154F003971FA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B5E0191FC1352099684AC5F8 /* Pods_Sample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2D406B1D1E9E154F003971FA = { + isa = PBXGroup; + children = ( + 2D406B281E9E154F003971FA /* Sample */, + 2D406B271E9E154F003971FA /* Products */, + 48DF875545E881029B1E6504 /* Pods */, + 779090BAD994C92139225E29 /* Frameworks */, + ); + sourceTree = ""; + }; + 2D406B271E9E154F003971FA /* Products */ = { + isa = PBXGroup; + children = ( + 2D406B261E9E154F003971FA /* Sample.app */, + ); + name = Products; + sourceTree = ""; + }; + 2D406B281E9E154F003971FA /* Sample */ = { + isa = PBXGroup; + children = ( + 2D406B291E9E154F003971FA /* AppDelegate.swift */, + 2D406B2B1E9E154F003971FA /* NodeController.swift */, + 2D406B3B1E9E1DD7003971FA /* CityGuideNodeController.swift */, + 2D406B3D1E9E2F06003971FA /* ImageCellNode.swift */, + 2D406B301E9E154F003971FA /* Assets.xcassets */, + 2D406B321E9E154F003971FA /* LaunchScreen.storyboard */, + 2D406B351E9E154F003971FA /* Info.plist */, + ); + path = Sample; + sourceTree = ""; + }; + 48DF875545E881029B1E6504 /* Pods */ = { + isa = PBXGroup; + children = ( + 6EBE5401BB9A4852372339F7 /* Pods-Sample.debug.xcconfig */, + E29468E54B5A1F870938978F /* Pods-Sample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 779090BAD994C92139225E29 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1ECB323B254D140F85EAB44D /* Pods_Sample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2D406B251E9E154F003971FA /* Sample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D406B381E9E154F003971FA /* Build configuration list for PBXNativeTarget "Sample" */; + buildPhases = ( + CD206D4E9850DAB147329AF8 /* [CP] Check Pods Manifest.lock */, + 2D406B221E9E154F003971FA /* Sources */, + 2D406B231E9E154F003971FA /* Frameworks */, + 2D406B241E9E154F003971FA /* Resources */, + 77869ADC74910E9F001ED904 /* [CP] Embed Pods Frameworks */, + 4E5810B230C4B278C01C061F /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Sample; + productName = Sample; + productReference = 2D406B261E9E154F003971FA /* Sample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2D406B1E1E9E154F003971FA /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "Bayerischer Rundfunk"; + TargetAttributes = { + 2D406B251E9E154F003971FA = { + CreatedOnToolsVersion = 8.2; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 2D406B211E9E154F003971FA /* Build configuration list for PBXProject "Sample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2D406B1D1E9E154F003971FA; + productRefGroup = 2D406B271E9E154F003971FA /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2D406B251E9E154F003971FA /* Sample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2D406B241E9E154F003971FA /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D406B341E9E154F003971FA /* LaunchScreen.storyboard in Resources */, + 2D406B311E9E154F003971FA /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 4E5810B230C4B278C01C061F /* [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-Sample/Pods-Sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 77869ADC74910E9F001ED904 /* [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-Sample/Pods-Sample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + CD206D4E9850DAB147329AF8 /* [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; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2D406B221E9E154F003971FA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D406B2C1E9E154F003971FA /* NodeController.swift in Sources */, + 2D406B2A1E9E154F003971FA /* AppDelegate.swift in Sources */, + 2D406B3C1E9E1DD7003971FA /* CityGuideNodeController.swift in Sources */, + 2D406B3E1E9E2F06003971FA /* ImageCellNode.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 2D406B321E9E154F003971FA /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 2D406B331E9E154F003971FA /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2D406B361E9E154F003971FA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + 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_DOCUMENTATION_COMMENTS = YES; + 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"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + 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_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 = 10.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 2D406B371E9E154F003971FA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + 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_DOCUMENTATION_COMMENTS = YES; + 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"; + 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 = 10.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 2D406B391E9E154F003971FA /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6EBE5401BB9A4852372339F7 /* Pods-Sample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = Sample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.AsyncDisplayKit.Sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 2D406B3A1E9E154F003971FA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E29468E54B5A1F870938978F /* Pods-Sample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = Sample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.facebook.AsyncDisplayKit.Sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2D406B211E9E154F003971FA /* Build configuration list for PBXProject "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D406B361E9E154F003971FA /* Debug */, + 2D406B371E9E154F003971FA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D406B381E9E154F003971FA /* Build configuration list for PBXNativeTarget "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D406B391E9E154F003971FA /* Debug */, + 2D406B3A1E9E154F003971FA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2D406B1E1E9E154F003971FA /* Project object */; +} diff --git a/examples/ASDK+HeroBasic/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/ASDK+HeroBasic/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..a80c03824 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/examples/ASDK+HeroBasic/Sample.xcworkspace/contents.xcworkspacedata b/examples/ASDK+HeroBasic/Sample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..7b5a2f305 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/examples/ASDK+HeroBasic/Sample/AppDelegate.swift b/examples/ASDK+HeroBasic/Sample/AppDelegate.swift new file mode 100644 index 000000000..1df27722a --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// Sample +// +// Created by Alexander Hüllmandel on 04/12/17 +// +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// This source code is licensed under the BSD-style license found in the +// LICENSE file in the root directory of this source tree. An additional grant +// of patent rights can be found in the PATENTS file in the same directory. +// +// 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 +// FACEBOOK 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. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + + window = UIWindow() + window?.rootViewController = NodeController() + window?.makeKeyAndVisible() + + return true + } +} + diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..1d060ed28 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "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" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/Contents.json b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/montreal.imageset/Contents.json b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/montreal.imageset/Contents.json new file mode 100644 index 000000000..76f195004 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/montreal.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "photo-1419041082630-1e98debd0a6a.jpeg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/montreal.imageset/photo-1419041082630-1e98debd0a6a.jpeg b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/montreal.imageset/photo-1419041082630-1e98debd0a6a.jpeg new file mode 100644 index 000000000..ef9289883 Binary files /dev/null and b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/montreal.imageset/photo-1419041082630-1e98debd0a6a.jpeg differ diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/toronto.imageset/Contents.json b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/toronto.imageset/Contents.json new file mode 100644 index 000000000..8fe6ebe4b --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/toronto.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "photo-1437147921639-ef00e030265a.jpeg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/toronto.imageset/photo-1437147921639-ef00e030265a.jpeg b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/toronto.imageset/photo-1437147921639-ef00e030265a.jpeg new file mode 100644 index 000000000..4cbad33a6 Binary files /dev/null and b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/toronto.imageset/photo-1437147921639-ef00e030265a.jpeg differ diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/vancouver.imageset/316f8e75.jpeg b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/vancouver.imageset/316f8e75.jpeg new file mode 100644 index 000000000..99f97c01c Binary files /dev/null and b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/vancouver.imageset/316f8e75.jpeg differ diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/vancouver.imageset/Contents.json b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/vancouver.imageset/Contents.json new file mode 100644 index 000000000..984e185d9 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/CityGuide/vancouver.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "316f8e75.jpeg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/Contents.json b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/Contents.json b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/Contents.json new file mode 100644 index 000000000..fd0af915e --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_keyboard_arrow_down.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_keyboard_arrow_down_2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_keyboard_arrow_down_3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down.png b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down.png new file mode 100644 index 000000000..5b1fa06bb Binary files /dev/null and b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down.png differ diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down_2x.png b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down_2x.png new file mode 100644 index 000000000..94016f48e Binary files /dev/null and b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down_2x.png differ diff --git a/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down_3x.png b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down_3x.png new file mode 100644 index 000000000..17811ae4e Binary files /dev/null and b/examples/ASDK+HeroBasic/Sample/Assets.xcassets/ic_keyboard_arrow_down.imageset/ic_keyboard_arrow_down_3x.png differ diff --git a/examples/ASDK+HeroBasic/Sample/Base.lproj/LaunchScreen.storyboard b/examples/ASDK+HeroBasic/Sample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..fdf3f97d1 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/ASDK+HeroBasic/Sample/CityGuideNodeController.swift b/examples/ASDK+HeroBasic/Sample/CityGuideNodeController.swift new file mode 100644 index 000000000..1dafd0001 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/CityGuideNodeController.swift @@ -0,0 +1,186 @@ +// +// CityGuideNodeController.swift +// Sample +// +// Created by Alexander Hüllmandel on 04/12/17 +// +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// This source code is licensed under the BSD-style license found in the +// LICENSE file in the root directory of this source tree. An additional grant +// of patent rights can be found in the PATENTS file in the same directory. +// +// 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 +// FACEBOOK 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. +// + +import UIKit +import AsyncDisplayKit +import Hero + +class CityGuideNodeController: ASViewController { + + let closeButton: ASButtonNode + let titleTextNode: ASTextNode + let sectionTextNode: ASTextNode + let collectionNode: ASCollectionNode + + let titles = ["Vancouver", "Toronto", "Montreal"] + let subtitles = ["City in British Columbia", "City in Ontario", "City in Québec"] + let images = [#imageLiteral(resourceName: "vancouver"), #imageLiteral(resourceName: "toronto"), #imageLiteral(resourceName: "montreal")] + + init() { + closeButton = ASButtonNode() + closeButton.setImage(#imageLiteral(resourceName: "ic_keyboard_arrow_down"), for: []) + closeButton.style.alignSelf = .start + closeButton.style.preferredSize = CGSize(width: 44, height: 44) + + titleTextNode = ASTextNode() + titleTextNode.attributedText = NSAttributedString(string: "Adventure awaits in CANADA", font: UIFont(name: "AvenirNext-Regular", size: 32.0)!, fontColor: .darkGray) + + titleTextNode.maximumNumberOfLines = 0 + + sectionTextNode = ASTextNode() + sectionTextNode.attributedText = NSAttributedString(string: "POPULAR DESTINATIONS", font: UIFont(name: "AvenirNext-Regular", size: 16.0)!, fontColor: .darkGray) + + sectionTextNode.maximumNumberOfLines = 1 + + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .horizontal + layout.minimumInteritemSpacing = 12 + collectionNode = ASCollectionNode(collectionViewLayout: layout) + + let node = ASDisplayNode() + node.backgroundColor = .white + node.automaticallyManagesSubnodes = true + + super.init(node: node) + + node.layoutSpecBlock = { [weak self] node, range in + guard let `self` = self else { return ASLayoutSpec() } + + let insetCollectionNode = ASInsetLayoutSpec(insets: UIEdgeInsets(top: 0, left: 15, bottom: 20, right: 15), child: self.collectionNode) + insetCollectionNode.style.flexGrow = 1.0 + insetCollectionNode.style.flexShrink = 1.0 + + let verticalStack = ASStackLayoutSpec() + verticalStack.direction = .vertical + verticalStack.justifyContent = .start + verticalStack.spacing = 20 + verticalStack.children = [ + ASInsetLayoutSpec(insets: UIEdgeInsets(top: 20, left: 15, bottom: 0, right: 15), child: self.closeButton), + ASInsetLayoutSpec(insets: UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15), child: self.titleTextNode), + ASInsetLayoutSpec(insets: UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15), child: self.sectionTextNode), + insetCollectionNode, + ] + + return verticalStack + } + + collectionNode.delegate = self + collectionNode.dataSource = self + } + + override func viewDidLoad() { + super.viewDidLoad() + + collectionNode.view.showsHorizontalScrollIndicator = false + closeButton.addTarget(self, action: #selector(closeTapped), forControlEvents: .touchUpInside) + + // hero modifiers + closeButton.view.heroModifiers = [.fade, .translate(CGPoint(x: 0, y: -150))] + titleTextNode.view.heroModifiers = [.fade, .translate(CGPoint(x: -150, y: 0))] + sectionTextNode.view.heroModifiers = [.fade, .translate(CGPoint(x: -150, y: 0))] + } + + @objc fileprivate func closeTapped() { + dismiss(animated: true, completion: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("Who needs storyboards...") + } +} + +extension CityGuideNodeController: ASCollectionDelegate, ASCollectionDataSource { + func numberOfSections(in collectionNode: ASCollectionNode) -> Int { + return 1 + } + + func collectionNode(_ collectionNode: ASCollectionNode, nodeBlockForItemAt indexPath: IndexPath) -> ASCellNodeBlock { + let title = titles[indexPath.row] + let subtitle = subtitles[indexPath.row] + let image = images[indexPath.row] + + return { + return ImageCellNode(title: title, subtitle: subtitle, image: image) + } + } + + func collectionNode(_ collectionNode: ASCollectionNode, constrainedSizeForItemAt indexPath: IndexPath) -> ASSizeRange { + let height = collectionNode.calculatedSize.height + return ASSizeRange(min: .zero, max: CGSize(width: 9.0/16.0*height, height: height)) + } + + func collectionNode(_ collectionNode: ASCollectionNode, numberOfItemsInSection section: Int) -> Int { + return titles.count + } +} + +extension CityGuideNodeController { + var toImageNode: ImageCellNode? { + guard let imageCellNode = collectionNode.nodeForItem(at: IndexPath(item: 0, section: 0)) as? ImageCellNode else { return nil } + return imageCellNode + } + + override func forceLayout() { + view.layoutIfNeeded() + collectionNode.waitUntilAllUpdatesAreCommitted() + collectionNode.view.layoutIfNeeded() + } +} + +extension NSAttributedString { + public convenience init(string: String, font: UIFont, fontColor: UIColor? = nil, lineBreakMode: NSLineBreakMode = .byWordWrapping, textAlignment: NSTextAlignment = NSTextAlignment.natural) { + + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.lineBreakMode = lineBreakMode + paragraphStyle.alignment = textAlignment + + let attributes = [NSFontAttributeName:font, + NSParagraphStyleAttributeName:paragraphStyle.copy(), + NSForegroundColorAttributeName: fontColor ?? .black] + + self.init(string: string, attributes: attributes) + } +} + +extension UIFont { + /// Returns a new font with a scale applied to the font size. + public func scaled(by: CGFloat) -> UIFont { + return self.withSize(self.pointSize * by) + } + + public func italicFont() -> UIFont { + return self.adding(traits: [.traitItalic]) + } + + public func boldFont() -> UIFont { + return self.adding(traits: [.traitBold]) + } + + /// Returns a new font by adding symbolic traits to the current traits. + public func adding(traits: UIFontDescriptorSymbolicTraits) -> UIFont { + return self.with(traits: self.fontDescriptor.symbolicTraits.union(traits)) + } + + /// Returns a new font with the provided symbolic traits. Old traits are not copied. + public func with(traits: UIFontDescriptorSymbolicTraits) -> UIFont { + + let newFontDescriptor = fontDescriptor.withSymbolicTraits(traits) + return UIFont(descriptor: newFontDescriptor!, size: pointSize) + } +} diff --git a/examples/ASDK+HeroBasic/Sample/ImageCellNode.swift b/examples/ASDK+HeroBasic/Sample/ImageCellNode.swift new file mode 100644 index 000000000..5d4934bc4 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/ImageCellNode.swift @@ -0,0 +1,60 @@ +// +// ImageCellNode.swift +// Sample +// +// Created by Alexander Hüllmandel on 04/12/17 +// +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// This source code is licensed under the BSD-style license found in the +// LICENSE file in the root directory of this source tree. An additional grant +// of patent rights can be found in the PATENTS file in the same directory. +// +// 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 +// FACEBOOK 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. +// + +import UIKit +import AsyncDisplayKit + +class ImageCellNode: ASCellNode { + let imageNode: ASImageNode + let titleNode: ASTextNode + let subtitleNode: ASTextNode + + init(title: String, subtitle: String, image: UIImage) { + titleNode = ASTextNode() + titleNode.attributedText = NSAttributedString(string: title, font: UIFont.systemFont(ofSize: 20.0), fontColor: .white) + titleNode.maximumNumberOfLines = 1 + + subtitleNode = ASTextNode() + subtitleNode.attributedText = NSAttributedString(string: subtitle, font: UIFont.systemFont(ofSize: 12), fontColor: .white) + subtitleNode.maximumNumberOfLines = 1 + + imageNode = ASImageNode() + imageNode.contentMode = .scaleAspectFit + imageNode.image = image + + super.init() + + cornerRadius = 7.0 + clipsToBounds = true + + automaticallyManagesSubnodes = true + } + + override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { + imageNode.style.preferredSize = constrainedSize.max + + let verticalStack = ASStackLayoutSpec() + verticalStack.direction = .vertical + verticalStack.spacing = 12 + verticalStack.children = [titleNode, subtitleNode] + + let insets = UIEdgeInsets(top: CGFloat.infinity, left: 20, bottom: 25, right: 20) + return ASOverlayLayoutSpec(child: imageNode, overlay: ASInsetLayoutSpec(insets: insets, child: verticalStack)) + } +} diff --git a/examples/ASDK+HeroBasic/Sample/Info.plist b/examples/ASDK+HeroBasic/Sample/Info.plist new file mode 100644 index 000000000..c12df3b8a --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/Info.plist @@ -0,0 +1,43 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/examples/ASDK+HeroBasic/Sample/NodeController.swift b/examples/ASDK+HeroBasic/Sample/NodeController.swift new file mode 100644 index 000000000..f379b1fa9 --- /dev/null +++ b/examples/ASDK+HeroBasic/Sample/NodeController.swift @@ -0,0 +1,85 @@ +// +// ViewController.swift +// Sample +// +// Created by Alexander Hüllmandel on 04/12/17 +// +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// This source code is licensed under the BSD-style license found in the +// LICENSE file in the root directory of this source tree. An additional grant +// of patent rights can be found in the PATENTS file in the same directory. +// +// 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 +// FACEBOOK 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. +// + +import UIKit +import AsyncDisplayKit +import Hero + +final class ImageCenteredDisplayNode: ASDisplayNode { + let imageNode: ASNetworkImageNode + var onImageTap: (()->())? + static let imageHeroId = "sample_id_0" + + override init() { + imageNode = ASNetworkImageNode() + imageNode.defaultImage = #imageLiteral(resourceName: "vancouver") + imageNode.style.preferredSize = CGSize(width: 200, height: 356) + imageNode.view.heroID = ImageCenteredDisplayNode.imageHeroId + + super.init() + + automaticallyManagesSubnodes = true + backgroundColor = .white + } + + override func didLoad() { + super.didLoad() + imageNode.addTarget(self, action: #selector(tap), forControlEvents: .touchUpInside) + } + + @objc fileprivate func tap() { + onImageTap?() + } + + override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec { + let centerSpec = ASCenterLayoutSpec() + centerSpec.sizingOptions = [.minimumXY] + centerSpec.centeringOptions = .XY + centerSpec.child = imageNode + return centerSpec + } +} + +class NodeController: ASViewController { + init() { + let node = ImageCenteredDisplayNode() + super.init(node: node) + + node.onImageTap = { [weak self] in + guard let `self` = self else { return } + + let vc = CityGuideNodeController() + vc.isHeroEnabled = true + vc.forceLayout() + vc.toImageNode?.imageNode.view.heroID = ImageCenteredDisplayNode.imageHeroId + + self.present(vc, animated: true, completion: nil) + } + } + + required init?(coder aDecoder: NSCoder) { + fatalError("Who needs storyboards...") + } +} + +extension ASViewController { + func forceLayout() { + view.layoutIfNeeded() + } +}