├── CoverPhotoTwitterExample.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── CoverPhotoTwitterExample.xccheckout │ └── xcuserdata │ │ └── ivanvavilov.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcshareddata │ └── xcschemes │ │ ├── CoverPhotoTwitterExample.xcscheme │ │ └── CoverPhotoTwitterExampleTests.xcscheme └── xcuserdata │ └── ivanvavilov.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── CoverPhotoTwitterExample ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard ├── CoverPhotoView.swift ├── Header.h ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Info.plist ├── UIImage Category │ ├── UIImage+ImageEffects.h │ └── UIImage+ImageEffects.m ├── ViewController.swift ├── chuck.jpg └── norris.jpg ├── CoverPhotoTwitterExampleTests ├── CoverPhotoTwitterExampleTests.swift └── Info.plist ├── README.md ├── circle.yml └── demo.gif /CoverPhotoTwitterExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E686B584199BE62D00D3E1FE /* CoverPhotoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E686B583199BE62D00D3E1FE /* CoverPhotoView.swift */; }; 11 | E686B586199BE73F00D3E1FE /* norris.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E686B585199BE73F00D3E1FE /* norris.jpg */; }; 12 | E686B58F199BEB6100D3E1FE /* UIImage+ImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = E686B58E199BEB6100D3E1FE /* UIImage+ImageEffects.m */; }; 13 | E686B592199BED8E00D3E1FE /* chuck.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E686B591199BED8E00D3E1FE /* chuck.jpg */; }; 14 | E69B0F4B199BE1000055DD62 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69B0F4A199BE1000055DD62 /* AppDelegate.swift */; }; 15 | E69B0F4D199BE1000055DD62 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69B0F4C199BE1000055DD62 /* ViewController.swift */; }; 16 | E69B0F50199BE1000055DD62 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E69B0F4E199BE1000055DD62 /* Main.storyboard */; }; 17 | E69B0F52199BE1000055DD62 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E69B0F51199BE1000055DD62 /* Images.xcassets */; }; 18 | E69B0F5E199BE1000055DD62 /* CoverPhotoTwitterExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69B0F5D199BE1000055DD62 /* CoverPhotoTwitterExampleTests.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | E69B0F58199BE1000055DD62 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = E69B0F3D199BE1000055DD62 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = E69B0F44199BE1000055DD62; 27 | remoteInfo = CoverPhotoTwitterExample; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | E686B583199BE62D00D3E1FE /* CoverPhotoView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoverPhotoView.swift; sourceTree = ""; }; 33 | E686B585199BE73F00D3E1FE /* norris.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = norris.jpg; sourceTree = ""; }; 34 | E686B58D199BEB5900D3E1FE /* UIImage+ImageEffects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImage+ImageEffects.h"; path = "UIImage Category/UIImage+ImageEffects.h"; sourceTree = ""; }; 35 | E686B58E199BEB6100D3E1FE /* UIImage+ImageEffects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImage+ImageEffects.m"; path = "UIImage Category/UIImage+ImageEffects.m"; sourceTree = ""; }; 36 | E686B590199BEBC700D3E1FE /* Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Header.h; sourceTree = ""; }; 37 | E686B591199BED8E00D3E1FE /* chuck.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = chuck.jpg; sourceTree = ""; }; 38 | E69B0F45199BE1000055DD62 /* CoverPhotoTwitterExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CoverPhotoTwitterExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | E69B0F49199BE1000055DD62 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | E69B0F4A199BE1000055DD62 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | E69B0F4C199BE1000055DD62 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 42 | E69B0F4F199BE1000055DD62 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | E69B0F51199BE1000055DD62 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 44 | E69B0F57199BE1000055DD62 /* CoverPhotoTwitterExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoverPhotoTwitterExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | E69B0F5C199BE1000055DD62 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | E69B0F5D199BE1000055DD62 /* CoverPhotoTwitterExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoverPhotoTwitterExampleTests.swift; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | E69B0F42199BE1000055DD62 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | E69B0F54199BE1000055DD62 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | E686B587199BE9C600D3E1FE /* UIImage Category */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | E686B58E199BEB6100D3E1FE /* UIImage+ImageEffects.m */, 71 | E686B58D199BEB5900D3E1FE /* UIImage+ImageEffects.h */, 72 | ); 73 | name = "UIImage Category"; 74 | sourceTree = ""; 75 | }; 76 | E686B593199BEF7300D3E1FE /* Assets */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | E686B585199BE73F00D3E1FE /* norris.jpg */, 80 | E686B591199BED8E00D3E1FE /* chuck.jpg */, 81 | ); 82 | name = Assets; 83 | sourceTree = ""; 84 | }; 85 | E69B0F3C199BE1000055DD62 = { 86 | isa = PBXGroup; 87 | children = ( 88 | E69B0F47199BE1000055DD62 /* CoverPhotoTwitterExample */, 89 | E69B0F5A199BE1000055DD62 /* CoverPhotoTwitterExampleTests */, 90 | E69B0F46199BE1000055DD62 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | E69B0F46199BE1000055DD62 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | E69B0F45199BE1000055DD62 /* CoverPhotoTwitterExample.app */, 98 | E69B0F57199BE1000055DD62 /* CoverPhotoTwitterExampleTests.xctest */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | E69B0F47199BE1000055DD62 /* CoverPhotoTwitterExample */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | E686B593199BEF7300D3E1FE /* Assets */, 107 | E686B587199BE9C600D3E1FE /* UIImage Category */, 108 | E69B0F4A199BE1000055DD62 /* AppDelegate.swift */, 109 | E69B0F4C199BE1000055DD62 /* ViewController.swift */, 110 | E69B0F4E199BE1000055DD62 /* Main.storyboard */, 111 | E69B0F51199BE1000055DD62 /* Images.xcassets */, 112 | E69B0F48199BE1000055DD62 /* Supporting Files */, 113 | E686B583199BE62D00D3E1FE /* CoverPhotoView.swift */, 114 | E686B590199BEBC700D3E1FE /* Header.h */, 115 | ); 116 | path = CoverPhotoTwitterExample; 117 | sourceTree = ""; 118 | }; 119 | E69B0F48199BE1000055DD62 /* Supporting Files */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | E69B0F49199BE1000055DD62 /* Info.plist */, 123 | ); 124 | name = "Supporting Files"; 125 | sourceTree = ""; 126 | }; 127 | E69B0F5A199BE1000055DD62 /* CoverPhotoTwitterExampleTests */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | E69B0F5D199BE1000055DD62 /* CoverPhotoTwitterExampleTests.swift */, 131 | E69B0F5B199BE1000055DD62 /* Supporting Files */, 132 | ); 133 | path = CoverPhotoTwitterExampleTests; 134 | sourceTree = ""; 135 | }; 136 | E69B0F5B199BE1000055DD62 /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | E69B0F5C199BE1000055DD62 /* Info.plist */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | /* End PBXGroup section */ 145 | 146 | /* Begin PBXNativeTarget section */ 147 | E69B0F44199BE1000055DD62 /* CoverPhotoTwitterExample */ = { 148 | isa = PBXNativeTarget; 149 | buildConfigurationList = E69B0F61199BE1000055DD62 /* Build configuration list for PBXNativeTarget "CoverPhotoTwitterExample" */; 150 | buildPhases = ( 151 | E69B0F41199BE1000055DD62 /* Sources */, 152 | E69B0F42199BE1000055DD62 /* Frameworks */, 153 | E69B0F43199BE1000055DD62 /* Resources */, 154 | ); 155 | buildRules = ( 156 | ); 157 | dependencies = ( 158 | ); 159 | name = CoverPhotoTwitterExample; 160 | productName = CoverPhotoTwitterExample; 161 | productReference = E69B0F45199BE1000055DD62 /* CoverPhotoTwitterExample.app */; 162 | productType = "com.apple.product-type.application"; 163 | }; 164 | E69B0F56199BE1000055DD62 /* CoverPhotoTwitterExampleTests */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = E69B0F64199BE1000055DD62 /* Build configuration list for PBXNativeTarget "CoverPhotoTwitterExampleTests" */; 167 | buildPhases = ( 168 | E69B0F53199BE1000055DD62 /* Sources */, 169 | E69B0F54199BE1000055DD62 /* Frameworks */, 170 | E69B0F55199BE1000055DD62 /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | E69B0F59199BE1000055DD62 /* PBXTargetDependency */, 176 | ); 177 | name = CoverPhotoTwitterExampleTests; 178 | productName = CoverPhotoTwitterExampleTests; 179 | productReference = E69B0F57199BE1000055DD62 /* CoverPhotoTwitterExampleTests.xctest */; 180 | productType = "com.apple.product-type.bundle.unit-test"; 181 | }; 182 | /* End PBXNativeTarget section */ 183 | 184 | /* Begin PBXProject section */ 185 | E69B0F3D199BE1000055DD62 /* Project object */ = { 186 | isa = PBXProject; 187 | attributes = { 188 | LastUpgradeCheck = 0600; 189 | ORGANIZATIONNAME = "Ivan Vavilov"; 190 | TargetAttributes = { 191 | E69B0F44199BE1000055DD62 = { 192 | CreatedOnToolsVersion = 6.0; 193 | }; 194 | E69B0F56199BE1000055DD62 = { 195 | CreatedOnToolsVersion = 6.0; 196 | TestTargetID = E69B0F44199BE1000055DD62; 197 | }; 198 | }; 199 | }; 200 | buildConfigurationList = E69B0F40199BE1000055DD62 /* Build configuration list for PBXProject "CoverPhotoTwitterExample" */; 201 | compatibilityVersion = "Xcode 3.2"; 202 | developmentRegion = English; 203 | hasScannedForEncodings = 0; 204 | knownRegions = ( 205 | en, 206 | Base, 207 | ); 208 | mainGroup = E69B0F3C199BE1000055DD62; 209 | productRefGroup = E69B0F46199BE1000055DD62 /* Products */; 210 | projectDirPath = ""; 211 | projectRoot = ""; 212 | targets = ( 213 | E69B0F44199BE1000055DD62 /* CoverPhotoTwitterExample */, 214 | E69B0F56199BE1000055DD62 /* CoverPhotoTwitterExampleTests */, 215 | ); 216 | }; 217 | /* End PBXProject section */ 218 | 219 | /* Begin PBXResourcesBuildPhase section */ 220 | E69B0F43199BE1000055DD62 /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | E686B586199BE73F00D3E1FE /* norris.jpg in Resources */, 225 | E69B0F50199BE1000055DD62 /* Main.storyboard in Resources */, 226 | E686B592199BED8E00D3E1FE /* chuck.jpg in Resources */, 227 | E69B0F52199BE1000055DD62 /* Images.xcassets in Resources */, 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | }; 231 | E69B0F55199BE1000055DD62 /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXResourcesBuildPhase section */ 239 | 240 | /* Begin PBXSourcesBuildPhase section */ 241 | E69B0F41199BE1000055DD62 /* Sources */ = { 242 | isa = PBXSourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | E686B58F199BEB6100D3E1FE /* UIImage+ImageEffects.m in Sources */, 246 | E69B0F4D199BE1000055DD62 /* ViewController.swift in Sources */, 247 | E69B0F4B199BE1000055DD62 /* AppDelegate.swift in Sources */, 248 | E686B584199BE62D00D3E1FE /* CoverPhotoView.swift in Sources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | E69B0F53199BE1000055DD62 /* Sources */ = { 253 | isa = PBXSourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | E69B0F5E199BE1000055DD62 /* CoverPhotoTwitterExampleTests.swift in Sources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | /* End PBXSourcesBuildPhase section */ 261 | 262 | /* Begin PBXTargetDependency section */ 263 | E69B0F59199BE1000055DD62 /* PBXTargetDependency */ = { 264 | isa = PBXTargetDependency; 265 | target = E69B0F44199BE1000055DD62 /* CoverPhotoTwitterExample */; 266 | targetProxy = E69B0F58199BE1000055DD62 /* PBXContainerItemProxy */; 267 | }; 268 | /* End PBXTargetDependency section */ 269 | 270 | /* Begin PBXVariantGroup section */ 271 | E69B0F4E199BE1000055DD62 /* Main.storyboard */ = { 272 | isa = PBXVariantGroup; 273 | children = ( 274 | E69B0F4F199BE1000055DD62 /* Base */, 275 | ); 276 | name = Main.storyboard; 277 | sourceTree = ""; 278 | }; 279 | /* End PBXVariantGroup section */ 280 | 281 | /* Begin XCBuildConfiguration section */ 282 | E69B0F5F199BE1000055DD62 /* Debug */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ALWAYS_SEARCH_USER_PATHS = NO; 286 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 287 | CLANG_CXX_LIBRARY = "libc++"; 288 | CLANG_ENABLE_MODULES = YES; 289 | CLANG_ENABLE_OBJC_ARC = YES; 290 | CLANG_WARN_BOOL_CONVERSION = YES; 291 | CLANG_WARN_CONSTANT_CONVERSION = YES; 292 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 293 | CLANG_WARN_EMPTY_BODY = YES; 294 | CLANG_WARN_ENUM_CONVERSION = YES; 295 | CLANG_WARN_INT_CONVERSION = YES; 296 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 297 | CLANG_WARN_UNREACHABLE_CODE = YES; 298 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 299 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 300 | COPY_PHASE_STRIP = NO; 301 | ENABLE_STRICT_OBJC_MSGSEND = YES; 302 | GCC_C_LANGUAGE_STANDARD = gnu99; 303 | GCC_DYNAMIC_NO_PIC = NO; 304 | GCC_OPTIMIZATION_LEVEL = 0; 305 | GCC_PREPROCESSOR_DEFINITIONS = ( 306 | "DEBUG=1", 307 | "$(inherited)", 308 | ); 309 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 317 | METAL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | SWIFT_OBJC_BRIDGING_HEADER = CoverPhotoTwitterExample/Header.h; 321 | "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = CoverPhotoTwitterExample/Header.h; 322 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 323 | }; 324 | name = Debug; 325 | }; 326 | E69B0F60199BE1000055DD62 /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_CONSTANT_CONVERSION = YES; 336 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 337 | CLANG_WARN_EMPTY_BODY = YES; 338 | CLANG_WARN_ENUM_CONVERSION = YES; 339 | CLANG_WARN_INT_CONVERSION = YES; 340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 341 | CLANG_WARN_UNREACHABLE_CODE = YES; 342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 343 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 344 | COPY_PHASE_STRIP = YES; 345 | ENABLE_NS_ASSERTIONS = NO; 346 | ENABLE_STRICT_OBJC_MSGSEND = YES; 347 | GCC_C_LANGUAGE_STANDARD = gnu99; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 355 | METAL_ENABLE_DEBUG_INFO = NO; 356 | SDKROOT = iphoneos; 357 | SWIFT_OBJC_BRIDGING_HEADER = CoverPhotoTwitterExample/Header.h; 358 | "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = CoverPhotoTwitterExample/Header.h; 359 | VALIDATE_PRODUCT = YES; 360 | }; 361 | name = Release; 362 | }; 363 | E69B0F62199BE1000055DD62 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 368 | INFOPLIST_FILE = CoverPhotoTwitterExample/Info.plist; 369 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | SWIFT_OBJC_BRIDGING_HEADER = CoverPhotoTwitterExample/Header.h; 372 | "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = CoverPhotoTwitterExample/Header.h; 373 | }; 374 | name = Debug; 375 | }; 376 | E69B0F63199BE1000055DD62 /* Release */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 380 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 381 | INFOPLIST_FILE = CoverPhotoTwitterExample/Info.plist; 382 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 383 | PRODUCT_NAME = "$(TARGET_NAME)"; 384 | SWIFT_OBJC_BRIDGING_HEADER = CoverPhotoTwitterExample/Header.h; 385 | "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = CoverPhotoTwitterExample/Header.h; 386 | }; 387 | name = Release; 388 | }; 389 | E69B0F65199BE1000055DD62 /* Debug */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CoverPhotoTwitterExample.app/CoverPhotoTwitterExample"; 393 | FRAMEWORK_SEARCH_PATHS = ( 394 | "$(SDKROOT)/Developer/Library/Frameworks", 395 | "$(inherited)", 396 | ); 397 | GCC_PREPROCESSOR_DEFINITIONS = ( 398 | "DEBUG=1", 399 | "$(inherited)", 400 | ); 401 | INFOPLIST_FILE = CoverPhotoTwitterExampleTests/Info.plist; 402 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 403 | METAL_ENABLE_DEBUG_INFO = YES; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | TEST_HOST = "$(BUNDLE_LOADER)"; 406 | }; 407 | name = Debug; 408 | }; 409 | E69B0F66199BE1000055DD62 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CoverPhotoTwitterExample.app/CoverPhotoTwitterExample"; 413 | FRAMEWORK_SEARCH_PATHS = ( 414 | "$(SDKROOT)/Developer/Library/Frameworks", 415 | "$(inherited)", 416 | ); 417 | INFOPLIST_FILE = CoverPhotoTwitterExampleTests/Info.plist; 418 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 419 | METAL_ENABLE_DEBUG_INFO = NO; 420 | PRODUCT_NAME = "$(TARGET_NAME)"; 421 | TEST_HOST = "$(BUNDLE_LOADER)"; 422 | }; 423 | name = Release; 424 | }; 425 | /* End XCBuildConfiguration section */ 426 | 427 | /* Begin XCConfigurationList section */ 428 | E69B0F40199BE1000055DD62 /* Build configuration list for PBXProject "CoverPhotoTwitterExample" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | E69B0F5F199BE1000055DD62 /* Debug */, 432 | E69B0F60199BE1000055DD62 /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | E69B0F61199BE1000055DD62 /* Build configuration list for PBXNativeTarget "CoverPhotoTwitterExample" */ = { 438 | isa = XCConfigurationList; 439 | buildConfigurations = ( 440 | E69B0F62199BE1000055DD62 /* Debug */, 441 | E69B0F63199BE1000055DD62 /* Release */, 442 | ); 443 | defaultConfigurationIsVisible = 0; 444 | defaultConfigurationName = Release; 445 | }; 446 | E69B0F64199BE1000055DD62 /* Build configuration list for PBXNativeTarget "CoverPhotoTwitterExampleTests" */ = { 447 | isa = XCConfigurationList; 448 | buildConfigurations = ( 449 | E69B0F65199BE1000055DD62 /* Debug */, 450 | E69B0F66199BE1000055DD62 /* Release */, 451 | ); 452 | defaultConfigurationIsVisible = 0; 453 | defaultConfigurationName = Release; 454 | }; 455 | /* End XCConfigurationList section */ 456 | }; 457 | rootObject = E69B0F3D199BE1000055DD62 /* Project object */; 458 | } 459 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample.xcodeproj/project.xcworkspace/xcshareddata/CoverPhotoTwitterExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 7C07C960-6E1A-4435-916F-CAECA347BCFF 9 | IDESourceControlProjectName 10 | CoverPhotoTwitterExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 78A0457BCE9D7CEE43562D33507F1F6468DD1F3E 14 | https://github.com/vani2/CoverPhotoTwitterExample.git 15 | 16 | IDESourceControlProjectPath 17 | CoverPhotoTwitterExample.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 78A0457BCE9D7CEE43562D33507F1F6468DD1F3E 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/vani2/CoverPhotoTwitterExample.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 78A0457BCE9D7CEE43562D33507F1F6468DD1F3E 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 78A0457BCE9D7CEE43562D33507F1F6468DD1F3E 36 | IDESourceControlWCCName 37 | CoverPhotoTwitterExample 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample.xcodeproj/project.xcworkspace/xcuserdata/ivanvavilov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vani2/CoverPhotoTwitterExample/9509716bfb7e662670dcb0e31ecc184692446edc/CoverPhotoTwitterExample.xcodeproj/project.xcworkspace/xcuserdata/ivanvavilov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CoverPhotoTwitterExample.xcodeproj/xcshareddata/xcschemes/CoverPhotoTwitterExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 63 | 69 | 70 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample.xcodeproj/xcshareddata/xcschemes/CoverPhotoTwitterExampleTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample.xcodeproj/xcuserdata/ivanvavilov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CoverPhotoTwitterExample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | CoverPhotoTwitterExampleTests.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | E69B0F44199BE1000055DD62 21 | 22 | primary 23 | 24 | 25 | E69B0F56199BE1000055DD62 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CoverPhotoTwitterExample 4 | // 5 | // Created by Ivan Vavilov on 13/08/14. 6 | // Copyright (c) 2014 Ivan Vavilov. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/CoverPhotoView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoverPhotoView.swift 3 | // CoverPhotoTwitterExample 4 | // 5 | // Created by Ivan Vavilov on 13/08/14. 6 | // Copyright (c) 2014 Ivan Vavilov. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CoverPhotoView: UIImageView { 12 | // You should redefine this method for touches interaction with cover photo like scrollview 13 | override func pointInside(point: CGPoint, withEvent event: UIEvent!) -> Bool { 14 | return false 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Header.h 3 | // CoverPhotoTwitterExample 4 | // 5 | // Created by Ivan Vavilov on 13/08/14. 6 | // Copyright (c) 2014 Ivan Vavilov. All rights reserved. 7 | // 8 | 9 | #ifndef CoverPhotoTwitterExample_Header_h 10 | #define CoverPhotoTwitterExample_Header_h 11 | 12 | #import "UIImage+ImageEffects.h" 13 | 14 | #endif -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | vani2.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/UIImage Category/UIImage+ImageEffects.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: UIImage+ImageEffects.h 3 | Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur. 4 | Version: 1.0 5 | 6 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 7 | Inc. ("Apple") in consideration of your agreement to the following 8 | terms, and your use, installation, modification or redistribution of 9 | this Apple software constitutes acceptance of these terms. If you do 10 | not agree with these terms, please do not use, install, modify or 11 | redistribute this Apple software. 12 | 13 | In consideration of your agreement to abide by the following terms, and 14 | subject to these terms, Apple grants you a personal, non-exclusive 15 | license, under Apple's copyrights in this original Apple software (the 16 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 17 | Software, with or without modifications, in source and/or binary forms; 18 | provided that if you redistribute the Apple Software in its entirety and 19 | without modifications, you must retain this notice and the following 20 | text and disclaimers in all such redistributions of the Apple Software. 21 | Neither the name, trademarks, service marks or logos of Apple Inc. may 22 | be used to endorse or promote products derived from the Apple Software 23 | without specific prior written permission from Apple. Except as 24 | expressly stated in this notice, no other rights or licenses, express or 25 | implied, are granted by Apple herein, including but not limited to any 26 | patent rights that may be infringed by your derivative works or by other 27 | works in which the Apple Software may be incorporated. 28 | 29 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 30 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 31 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 32 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 33 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 34 | 35 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 36 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 37 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 38 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 39 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 40 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 41 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 42 | POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 45 | 46 | 47 | Copyright © 2013 Apple Inc. All rights reserved. 48 | WWDC 2013 License 49 | 50 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2013 51 | Session. Please refer to the applicable WWDC 2013 Session for further 52 | information. 53 | 54 | IMPORTANT: This Apple software is supplied to you by Apple Inc. 55 | ("Apple") in consideration of your agreement to the following terms, and 56 | your use, installation, modification or redistribution of this Apple 57 | software constitutes acceptance of these terms. If you do not agree with 58 | these terms, please do not use, install, modify or redistribute this 59 | Apple software. 60 | 61 | In consideration of your agreement to abide by the following terms, and 62 | subject to these terms, Apple grants you a non-exclusive license, under 63 | Apple's copyrights in this original Apple software (the "Apple 64 | Software"), to use, reproduce, modify and redistribute the Apple 65 | Software, with or without modifications, in source and/or binary forms; 66 | provided that if you redistribute the Apple Software in its entirety and 67 | without modifications, you must retain this notice and the following 68 | text and disclaimers in all such redistributions of the Apple Software. 69 | Neither the name, trademarks, service marks or logos of Apple Inc. may 70 | be used to endorse or promote products derived from the Apple Software 71 | without specific prior written permission from Apple. Except as 72 | expressly stated in this notice, no other rights or licenses, express or 73 | implied, are granted by Apple herein, including but not limited to any 74 | patent rights that may be infringed by your derivative works or by other 75 | works in which the Apple Software may be incorporated. 76 | 77 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES 78 | NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE 79 | IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR 80 | A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 81 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 82 | 83 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 84 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 85 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 86 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 87 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 88 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 89 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 90 | POSSIBILITY OF SUCH DAMAGE. 91 | 92 | EA1002 93 | 5/3/2013 94 | */ 95 | 96 | @import UIKit; 97 | 98 | @interface UIImage (ImageEffects) 99 | 100 | - (UIImage *)applyLightEffect; 101 | - (UIImage *)applyExtraLightEffect; 102 | - (UIImage *)applyDarkEffect; 103 | - (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor; 104 | 105 | - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage; 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/UIImage Category/UIImage+ImageEffects.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: UIImage+ImageEffects.m 3 | Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur. 4 | Version: 1.0 5 | 6 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 7 | Inc. ("Apple") in consideration of your agreement to the following 8 | terms, and your use, installation, modification or redistribution of 9 | this Apple software constitutes acceptance of these terms. If you do 10 | not agree with these terms, please do not use, install, modify or 11 | redistribute this Apple software. 12 | 13 | In consideration of your agreement to abide by the following terms, and 14 | subject to these terms, Apple grants you a personal, non-exclusive 15 | license, under Apple's copyrights in this original Apple software (the 16 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 17 | Software, with or without modifications, in source and/or binary forms; 18 | provided that if you redistribute the Apple Software in its entirety and 19 | without modifications, you must retain this notice and the following 20 | text and disclaimers in all such redistributions of the Apple Software. 21 | Neither the name, trademarks, service marks or logos of Apple Inc. may 22 | be used to endorse or promote products derived from the Apple Software 23 | without specific prior written permission from Apple. Except as 24 | expressly stated in this notice, no other rights or licenses, express or 25 | implied, are granted by Apple herein, including but not limited to any 26 | patent rights that may be infringed by your derivative works or by other 27 | works in which the Apple Software may be incorporated. 28 | 29 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 30 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 31 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 32 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 33 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 34 | 35 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 36 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 37 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 38 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 39 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 40 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 41 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 42 | POSSIBILITY OF SUCH DAMAGE. 43 | 44 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 45 | 46 | 47 | Copyright © 2013 Apple Inc. All rights reserved. 48 | WWDC 2013 License 49 | 50 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2013 51 | Session. Please refer to the applicable WWDC 2013 Session for further 52 | information. 53 | 54 | IMPORTANT: This Apple software is supplied to you by Apple Inc. 55 | ("Apple") in consideration of your agreement to the following terms, and 56 | your use, installation, modification or redistribution of this Apple 57 | software constitutes acceptance of these terms. If you do not agree with 58 | these terms, please do not use, install, modify or redistribute this 59 | Apple software. 60 | 61 | In consideration of your agreement to abide by the following terms, and 62 | subject to these terms, Apple grants you a non-exclusive license, under 63 | Apple's copyrights in this original Apple software (the "Apple 64 | Software"), to use, reproduce, modify and redistribute the Apple 65 | Software, with or without modifications, in source and/or binary forms; 66 | provided that if you redistribute the Apple Software in its entirety and 67 | without modifications, you must retain this notice and the following 68 | text and disclaimers in all such redistributions of the Apple Software. 69 | Neither the name, trademarks, service marks or logos of Apple Inc. may 70 | be used to endorse or promote products derived from the Apple Software 71 | without specific prior written permission from Apple. Except as 72 | expressly stated in this notice, no other rights or licenses, express or 73 | implied, are granted by Apple herein, including but not limited to any 74 | patent rights that may be infringed by your derivative works or by other 75 | works in which the Apple Software may be incorporated. 76 | 77 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES 78 | NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE 79 | IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR 80 | A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 81 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 82 | 83 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 84 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 85 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 86 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 87 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 88 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 89 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 90 | POSSIBILITY OF SUCH DAMAGE. 91 | 92 | EA1002 93 | 5/3/2013 94 | */ 95 | 96 | #import "UIImage+ImageEffects.h" 97 | 98 | @import Accelerate; 99 | #import 100 | 101 | 102 | @implementation UIImage (ImageEffects) 103 | 104 | 105 | - (UIImage *)applyLightEffect 106 | { 107 | UIColor *tintColor = [UIColor colorWithWhite:1.0 alpha:0.3]; 108 | return [self applyBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; 109 | } 110 | 111 | 112 | - (UIImage *)applyExtraLightEffect 113 | { 114 | UIColor *tintColor = [UIColor colorWithWhite:0.97 alpha:0.82]; 115 | return [self applyBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; 116 | } 117 | 118 | 119 | - (UIImage *)applyDarkEffect 120 | { 121 | UIColor *tintColor = [UIColor colorWithWhite:0.11 alpha:0.73]; 122 | return [self applyBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; 123 | } 124 | 125 | 126 | - (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor 127 | { 128 | const CGFloat EffectColorAlpha = 0.6; 129 | UIColor *effectColor = tintColor; 130 | int componentCount = (int) CGColorGetNumberOfComponents(tintColor.CGColor); 131 | if (componentCount == 2) { 132 | CGFloat b; 133 | if ([tintColor getWhite:&b alpha:NULL]) { 134 | effectColor = [UIColor colorWithWhite:b alpha:EffectColorAlpha]; 135 | } 136 | } 137 | else { 138 | CGFloat r, g, b; 139 | if ([tintColor getRed:&r green:&g blue:&b alpha:NULL]) { 140 | effectColor = [UIColor colorWithRed:r green:g blue:b alpha:EffectColorAlpha]; 141 | } 142 | } 143 | return [self applyBlurWithRadius:10 tintColor:effectColor saturationDeltaFactor:-1.0 maskImage:nil]; 144 | } 145 | 146 | 147 | - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage 148 | { 149 | // Check pre-conditions. 150 | if (self.size.width < 1 || self.size.height < 1) { 151 | NSLog (@"*** error: invalid size: (%.2f x %.2f). Both dimensions must be >= 1: %@", self.size.width, self.size.height, self); 152 | return nil; 153 | } 154 | if (!self.CGImage) { 155 | NSLog (@"*** error: image must be backed by a CGImage: %@", self); 156 | return nil; 157 | } 158 | if (maskImage && !maskImage.CGImage) { 159 | NSLog (@"*** error: maskImage must be backed by a CGImage: %@", maskImage); 160 | return nil; 161 | } 162 | 163 | CGRect imageRect = { CGPointZero, self.size }; 164 | UIImage *effectImage = self; 165 | 166 | BOOL hasBlur = blurRadius > __FLT_EPSILON__; 167 | BOOL hasSaturationChange = fabs(saturationDeltaFactor - 1.) > __FLT_EPSILON__; 168 | if (hasBlur || hasSaturationChange) { 169 | UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); 170 | CGContextRef effectInContext = UIGraphicsGetCurrentContext(); 171 | CGContextScaleCTM(effectInContext, 1.0, -1.0); 172 | CGContextTranslateCTM(effectInContext, 0, -self.size.height); 173 | CGContextDrawImage(effectInContext, imageRect, self.CGImage); 174 | 175 | vImage_Buffer effectInBuffer; 176 | effectInBuffer.data = CGBitmapContextGetData(effectInContext); 177 | effectInBuffer.width = CGBitmapContextGetWidth(effectInContext); 178 | effectInBuffer.height = CGBitmapContextGetHeight(effectInContext); 179 | effectInBuffer.rowBytes = CGBitmapContextGetBytesPerRow(effectInContext); 180 | 181 | UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); 182 | CGContextRef effectOutContext = UIGraphicsGetCurrentContext(); 183 | vImage_Buffer effectOutBuffer; 184 | effectOutBuffer.data = CGBitmapContextGetData(effectOutContext); 185 | effectOutBuffer.width = CGBitmapContextGetWidth(effectOutContext); 186 | effectOutBuffer.height = CGBitmapContextGetHeight(effectOutContext); 187 | effectOutBuffer.rowBytes = CGBitmapContextGetBytesPerRow(effectOutContext); 188 | 189 | if (hasBlur) { 190 | // A description of how to compute the box kernel width from the Gaussian 191 | // radius (aka standard deviation) appears in the SVG spec: 192 | // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement 193 | // 194 | // For larger values of 's' (s >= 2.0), an approximation can be used: Three 195 | // successive box-blurs build a piece-wise quadratic convolution kernel, which 196 | // approximates the Gaussian kernel to within roughly 3%. 197 | // 198 | // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5) 199 | // 200 | // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel. 201 | // 202 | CGFloat inputRadius = blurRadius * [[UIScreen mainScreen] scale]; 203 | NSUInteger radius = floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5); 204 | if (radius % 2 != 1) { 205 | radius += 1; // force radius to be odd so that the three box-blur methodology works. 206 | } 207 | vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, NULL, 0, 0, (unsigned int) radius, (unsigned int) radius, 0, kvImageEdgeExtend); 208 | vImageBoxConvolve_ARGB8888(&effectOutBuffer, &effectInBuffer, NULL, 0, 0, (unsigned int) radius, (unsigned int) radius, 0, kvImageEdgeExtend); 209 | vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, NULL, 0, 0, (unsigned int) radius, (unsigned int) radius, 0, kvImageEdgeExtend); 210 | } 211 | BOOL effectImageBuffersAreSwapped = NO; 212 | if (hasSaturationChange) { 213 | CGFloat s = saturationDeltaFactor; 214 | CGFloat floatingPointSaturationMatrix[] = { 215 | 0.0722 + 0.9278 * s, 0.0722 - 0.0722 * s, 0.0722 - 0.0722 * s, 0, 216 | 0.7152 - 0.7152 * s, 0.7152 + 0.2848 * s, 0.7152 - 0.7152 * s, 0, 217 | 0.2126 - 0.2126 * s, 0.2126 - 0.2126 * s, 0.2126 + 0.7873 * s, 0, 218 | 0, 0, 0, 1, 219 | }; 220 | const int32_t divisor = 256; 221 | NSUInteger matrixSize = sizeof(floatingPointSaturationMatrix)/sizeof(floatingPointSaturationMatrix[0]); 222 | int16_t saturationMatrix[matrixSize]; 223 | for (NSUInteger i = 0; i < matrixSize; ++i) { 224 | saturationMatrix[i] = (int16_t)roundf(floatingPointSaturationMatrix[i] * divisor); 225 | } 226 | if (hasBlur) { 227 | vImageMatrixMultiply_ARGB8888(&effectOutBuffer, &effectInBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags); 228 | effectImageBuffersAreSwapped = YES; 229 | } 230 | else { 231 | vImageMatrixMultiply_ARGB8888(&effectInBuffer, &effectOutBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags); 232 | } 233 | } 234 | if (!effectImageBuffersAreSwapped) 235 | effectImage = UIGraphicsGetImageFromCurrentImageContext(); 236 | UIGraphicsEndImageContext(); 237 | 238 | if (effectImageBuffersAreSwapped) 239 | effectImage = UIGraphicsGetImageFromCurrentImageContext(); 240 | UIGraphicsEndImageContext(); 241 | } 242 | 243 | // Set up output context. 244 | UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); 245 | CGContextRef outputContext = UIGraphicsGetCurrentContext(); 246 | CGContextScaleCTM(outputContext, 1.0, -1.0); 247 | CGContextTranslateCTM(outputContext, 0, -self.size.height); 248 | 249 | // Draw base image. 250 | CGContextDrawImage(outputContext, imageRect, self.CGImage); 251 | 252 | // Draw effect image. 253 | if (hasBlur) { 254 | CGContextSaveGState(outputContext); 255 | if (maskImage) { 256 | CGContextClipToMask(outputContext, imageRect, maskImage.CGImage); 257 | } 258 | CGContextDrawImage(outputContext, imageRect, effectImage.CGImage); 259 | CGContextRestoreGState(outputContext); 260 | } 261 | 262 | // Add in color tint. 263 | if (tintColor) { 264 | CGContextSaveGState(outputContext); 265 | CGContextSetFillColorWithColor(outputContext, tintColor.CGColor); 266 | CGContextFillRect(outputContext, imageRect); 267 | CGContextRestoreGState(outputContext); 268 | } 269 | 270 | // Output image is ready. 271 | UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext(); 272 | UIGraphicsEndImageContext(); 273 | 274 | return outputImage; 275 | } 276 | 277 | 278 | 279 | @end 280 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CoverPhotoTwitterExample 4 | // 5 | // Created by Ivan Vavilov on 13/08/14. 6 | // Copyright (c) 2014 Ivan Vavilov. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UIScrollViewDelegate { 12 | 13 | // MARK: Constants 14 | let kInitialCoverPhotoVerticalSpace:CGFloat = 0 15 | let kInitialCoverPhotoImageViewHeight:CGFloat = 160 16 | 17 | let kCirclePhotoBorderWidth:CGFloat = 1 18 | let kInitialCoverPhotoBlurRadius:CGFloat = 2 19 | let kWhiteComponentBlurTintColor:CGFloat = 0.4 20 | let kAlphaComponentBlurTintColor:CGFloat = 0.15 21 | let kCoverPhotoSaturationDeltaFactor:CGFloat = 1 22 | let kBlurFactor:CGFloat = 0.05 23 | 24 | // MARK Outlets 25 | @IBOutlet var scrollView : UIScrollView! 26 | @IBOutlet var coverPhotoImageView : UIImageView! 27 | @IBOutlet var circlePhotoImageView : UIImageView! 28 | 29 | @IBOutlet var coverPhotoImageViewTopSpaceConstraint : NSLayoutConstraint! 30 | @IBOutlet var scrollViewContentTopSpaceConstraint : NSLayoutConstraint! 31 | @IBOutlet var coverPhotoImageViewHeight : NSLayoutConstraint! 32 | @IBOutlet var circlePhotoHeight : NSLayoutConstraint! 33 | 34 | // MARK Instance Variables 35 | var originalCoverImage:UIImage? 36 | 37 | // MARK View Lyfecycle 38 | override func viewDidLoad() { 39 | super.viewDidLoad() 40 | setupUI() 41 | } 42 | 43 | func setupUI() { 44 | scrollView.delegate = self 45 | setupCoverPhoto() 46 | setupCirclePhoto() 47 | } 48 | 49 | func setupCoverPhoto() { 50 | originalCoverImage = UIImage(named: "norris.jpg") 51 | coverPhotoImageView.image = originalCoverImage 52 | blurCoverPhoto(kInitialCoverPhotoBlurRadius) 53 | } 54 | 55 | func setupCirclePhoto() { 56 | circlePhotoImageView.image = UIImage(named: "chuck.jpg") 57 | circlePhotoImageView.layer.cornerRadius = circlePhotoHeight.constant/2 58 | circlePhotoImageView.layer.masksToBounds = true 59 | circlePhotoImageView.layer.borderWidth = kCirclePhotoBorderWidth 60 | circlePhotoImageView.layer.borderColor = UIColor.whiteColor().CGColor 61 | } 62 | 63 | func blurCoverPhoto(radius:CGFloat) { 64 | let blurTintColor:UIColor! = UIColor(white:kWhiteComponentBlurTintColor, alpha:kAlphaComponentBlurTintColor) 65 | 66 | coverPhotoImageView.image = self.originalCoverImage?.applyBlurWithRadius(radius, tintColor: blurTintColor, saturationDeltaFactor: kCoverPhotoSaturationDeltaFactor, maskImage: nil) 67 | } 68 | 69 | // MARK Scroll View Delegate 70 | func scrollViewDidScroll(scrollView: UIScrollView!) { 71 | let delta = scrollView.contentOffset.y 72 | 73 | if delta >= 0 { 74 | coverPhotoImageViewTopSpaceConstraint.constant = kInitialCoverPhotoVerticalSpace - delta 75 | blurCoverPhoto(kInitialCoverPhotoBlurRadius) 76 | } 77 | else { 78 | coverPhotoImageViewHeight.constant = kInitialCoverPhotoImageViewHeight - delta 79 | blurCoverPhoto(kInitialCoverPhotoBlurRadius - delta*kBlurFactor) 80 | } 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/chuck.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vani2/CoverPhotoTwitterExample/9509716bfb7e662670dcb0e31ecc184692446edc/CoverPhotoTwitterExample/chuck.jpg -------------------------------------------------------------------------------- /CoverPhotoTwitterExample/norris.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vani2/CoverPhotoTwitterExample/9509716bfb7e662670dcb0e31ecc184692446edc/CoverPhotoTwitterExample/norris.jpg -------------------------------------------------------------------------------- /CoverPhotoTwitterExampleTests/CoverPhotoTwitterExampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoverPhotoTwitterExampleTests.swift 3 | // CoverPhotoTwitterExampleTests 4 | // 5 | // Created by Ivan Vavilov on 13/08/14. 6 | // Copyright (c) 2014 Ivan Vavilov. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class CoverPhotoTwitterExampleTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /CoverPhotoTwitterExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | vani2.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CoverPhotoTwitterExample 2 | ======================== 3 | 4 | Example of blurred expanding cover photo like twitter app 5 | 6 | The Problem is every popular examples show how to create this feature manually in code. Check my example, fully compatible with autolayout, created in Xcode 6 using Swift. 7 | 8 | 9 | ![alt tag](https://github.com/vani2/CoverPhotoTwitterExample/blob/master/demo.gif) 10 | 11 | Important 12 | ======================== 13 | 1. I use UIImage category for blurring written on objC. 14 | 2. Look carefully into views hierarhy. If you put image view inside scroll view there will be some scroll bugs. 15 | 16 | *FYI This is not the best implementation, becase every scroll picture should be filtered. For your exercise create two pictures: maximum blurred under original and change original image alpha from 1 to 0 when scroll. It works fine at old models and consump less energy.* 17 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | xcode: 3 | version: "6.3.1" -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vani2/CoverPhotoTwitterExample/9509716bfb7e662670dcb0e31ecc184692446edc/demo.gif --------------------------------------------------------------------------------