├── Images ├── MTPhotosGallery.gif └── MTPhotosGallery.png ├── Project └── MTPhotosGallery │ ├── MTPhotosGallery.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── devubhamanek.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── devubhamanek.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── MTPhotosGallery.xcscheme │ │ └── xcschememanagement.plist │ └── MTPhotosGallery │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x-1.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x-1.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x-1.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ ├── Contents.json │ ├── imgBackground1.imageset │ │ ├── Contents.json │ │ └── imgBackground1.png │ ├── imgPhotosAlbum1.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum1.jpeg │ ├── imgPhotosAlbum10.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum10.jpeg │ ├── imgPhotosAlbum11.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum11.jpeg │ ├── imgPhotosAlbum12.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum12.jpg │ ├── imgPhotosAlbum2.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum2.png │ ├── imgPhotosAlbum3.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum3.jpeg │ ├── imgPhotosAlbum4.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum4.jpeg │ ├── imgPhotosAlbum5.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum5.jpeg │ ├── imgPhotosAlbum6.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum6.jpeg │ ├── imgPhotosAlbum7.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum7.jpeg │ ├── imgPhotosAlbum8.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum8.jpeg │ └── imgPhotosAlbum9.imageset │ │ ├── Contents.json │ │ └── imgPhotosAlbum9.jpeg │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── MTPhotosGallery.xcdatamodeld │ ├── .xccurrentversion │ └── MTPhotosGallery.xcdatamodel │ │ └── contents │ ├── PhotosGalleryView.swift │ └── ViewController.swift └── README.md /Images/MTPhotosGallery.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Images/MTPhotosGallery.gif -------------------------------------------------------------------------------- /Images/MTPhotosGallery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Images/MTPhotosGallery.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 17E7C4F91E252729003C2F58 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E7C4F81E252729003C2F58 /* AppDelegate.swift */; }; 11 | 17E7C4FB1E252729003C2F58 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E7C4FA1E252729003C2F58 /* ViewController.swift */; }; 12 | 17E7C4FE1E252729003C2F58 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 17E7C4FC1E252729003C2F58 /* Main.storyboard */; }; 13 | 17E7C5011E252729003C2F58 /* MTPhotosGallery.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 17E7C4FF1E252729003C2F58 /* MTPhotosGallery.xcdatamodeld */; }; 14 | 17E7C5031E252729003C2F58 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 17E7C5021E252729003C2F58 /* Assets.xcassets */; }; 15 | 17E7C5061E252729003C2F58 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 17E7C5041E252729003C2F58 /* LaunchScreen.storyboard */; }; 16 | 17E7C50F1E2527B6003C2F58 /* PhotosGalleryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E7C50E1E2527B6003C2F58 /* PhotosGalleryView.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 17E7C4F51E252729003C2F58 /* MTPhotosGallery.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MTPhotosGallery.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 17E7C4F81E252729003C2F58 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 17E7C4FA1E252729003C2F58 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | 17E7C4FD1E252729003C2F58 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 17E7C5001E252729003C2F58 /* MTPhotosGallery.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MTPhotosGallery.xcdatamodel; sourceTree = ""; }; 25 | 17E7C5021E252729003C2F58 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 17E7C5051E252729003C2F58 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | 17E7C5071E252729003C2F58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 17E7C50E1E2527B6003C2F58 /* PhotosGalleryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotosGalleryView.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 17E7C4F21E252729003C2F58 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 17E7C4EC1E252729003C2F58 = { 43 | isa = PBXGroup; 44 | children = ( 45 | 17E7C4F71E252729003C2F58 /* MTPhotosGallery */, 46 | 17E7C4F61E252729003C2F58 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 17E7C4F61E252729003C2F58 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 17E7C4F51E252729003C2F58 /* MTPhotosGallery.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 17E7C4F71E252729003C2F58 /* MTPhotosGallery */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 17E7C50E1E2527B6003C2F58 /* PhotosGalleryView.swift */, 62 | 17E7C4F81E252729003C2F58 /* AppDelegate.swift */, 63 | 17E7C4FA1E252729003C2F58 /* ViewController.swift */, 64 | 17E7C4FC1E252729003C2F58 /* Main.storyboard */, 65 | 17E7C5021E252729003C2F58 /* Assets.xcassets */, 66 | 17E7C5041E252729003C2F58 /* LaunchScreen.storyboard */, 67 | 17E7C5071E252729003C2F58 /* Info.plist */, 68 | 17E7C4FF1E252729003C2F58 /* MTPhotosGallery.xcdatamodeld */, 69 | ); 70 | path = MTPhotosGallery; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | 17E7C4F41E252729003C2F58 /* MTPhotosGallery */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = 17E7C50A1E252729003C2F58 /* Build configuration list for PBXNativeTarget "MTPhotosGallery" */; 79 | buildPhases = ( 80 | 17E7C4F11E252729003C2F58 /* Sources */, 81 | 17E7C4F21E252729003C2F58 /* Frameworks */, 82 | 17E7C4F31E252729003C2F58 /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = MTPhotosGallery; 89 | productName = MTPhotosGallery; 90 | productReference = 17E7C4F51E252729003C2F58 /* MTPhotosGallery.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | 17E7C4ED1E252729003C2F58 /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastSwiftUpdateCheck = 0810; 100 | LastUpgradeCheck = 0810; 101 | ORGANIZATIONNAME = "Devubha Manek"; 102 | TargetAttributes = { 103 | 17E7C4F41E252729003C2F58 = { 104 | CreatedOnToolsVersion = 8.1; 105 | DevelopmentTeam = CJESF9R9MD; 106 | ProvisioningStyle = Manual; 107 | }; 108 | }; 109 | }; 110 | buildConfigurationList = 17E7C4F01E252729003C2F58 /* Build configuration list for PBXProject "MTPhotosGallery" */; 111 | compatibilityVersion = "Xcode 3.2"; 112 | developmentRegion = English; 113 | hasScannedForEncodings = 0; 114 | knownRegions = ( 115 | en, 116 | Base, 117 | ); 118 | mainGroup = 17E7C4EC1E252729003C2F58; 119 | productRefGroup = 17E7C4F61E252729003C2F58 /* Products */; 120 | projectDirPath = ""; 121 | projectRoot = ""; 122 | targets = ( 123 | 17E7C4F41E252729003C2F58 /* MTPhotosGallery */, 124 | ); 125 | }; 126 | /* End PBXProject section */ 127 | 128 | /* Begin PBXResourcesBuildPhase section */ 129 | 17E7C4F31E252729003C2F58 /* Resources */ = { 130 | isa = PBXResourcesBuildPhase; 131 | buildActionMask = 2147483647; 132 | files = ( 133 | 17E7C5061E252729003C2F58 /* LaunchScreen.storyboard in Resources */, 134 | 17E7C5031E252729003C2F58 /* Assets.xcassets in Resources */, 135 | 17E7C4FE1E252729003C2F58 /* Main.storyboard in Resources */, 136 | ); 137 | runOnlyForDeploymentPostprocessing = 0; 138 | }; 139 | /* End PBXResourcesBuildPhase section */ 140 | 141 | /* Begin PBXSourcesBuildPhase section */ 142 | 17E7C4F11E252729003C2F58 /* Sources */ = { 143 | isa = PBXSourcesBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 17E7C5011E252729003C2F58 /* MTPhotosGallery.xcdatamodeld in Sources */, 147 | 17E7C4FB1E252729003C2F58 /* ViewController.swift in Sources */, 148 | 17E7C50F1E2527B6003C2F58 /* PhotosGalleryView.swift in Sources */, 149 | 17E7C4F91E252729003C2F58 /* AppDelegate.swift in Sources */, 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | /* End PBXSourcesBuildPhase section */ 154 | 155 | /* Begin PBXVariantGroup section */ 156 | 17E7C4FC1E252729003C2F58 /* Main.storyboard */ = { 157 | isa = PBXVariantGroup; 158 | children = ( 159 | 17E7C4FD1E252729003C2F58 /* Base */, 160 | ); 161 | name = Main.storyboard; 162 | sourceTree = ""; 163 | }; 164 | 17E7C5041E252729003C2F58 /* LaunchScreen.storyboard */ = { 165 | isa = PBXVariantGroup; 166 | children = ( 167 | 17E7C5051E252729003C2F58 /* Base */, 168 | ); 169 | name = LaunchScreen.storyboard; 170 | sourceTree = ""; 171 | }; 172 | /* End PBXVariantGroup section */ 173 | 174 | /* Begin XCBuildConfiguration section */ 175 | 17E7C5081E252729003C2F58 /* Debug */ = { 176 | isa = XCBuildConfiguration; 177 | buildSettings = { 178 | ALWAYS_SEARCH_USER_PATHS = NO; 179 | CLANG_ANALYZER_NONNULL = YES; 180 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 181 | CLANG_CXX_LIBRARY = "libc++"; 182 | CLANG_ENABLE_MODULES = YES; 183 | CLANG_ENABLE_OBJC_ARC = YES; 184 | CLANG_WARN_BOOL_CONVERSION = YES; 185 | CLANG_WARN_CONSTANT_CONVERSION = YES; 186 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 187 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 188 | CLANG_WARN_EMPTY_BODY = YES; 189 | CLANG_WARN_ENUM_CONVERSION = YES; 190 | CLANG_WARN_INFINITE_RECURSION = YES; 191 | CLANG_WARN_INT_CONVERSION = YES; 192 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 193 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 194 | CLANG_WARN_UNREACHABLE_CODE = YES; 195 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 196 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 197 | COPY_PHASE_STRIP = NO; 198 | DEBUG_INFORMATION_FORMAT = dwarf; 199 | ENABLE_STRICT_OBJC_MSGSEND = YES; 200 | ENABLE_TESTABILITY = YES; 201 | GCC_C_LANGUAGE_STANDARD = gnu99; 202 | GCC_DYNAMIC_NO_PIC = NO; 203 | GCC_NO_COMMON_BLOCKS = YES; 204 | GCC_OPTIMIZATION_LEVEL = 0; 205 | GCC_PREPROCESSOR_DEFINITIONS = ( 206 | "DEBUG=1", 207 | "$(inherited)", 208 | ); 209 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 210 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 211 | GCC_WARN_UNDECLARED_SELECTOR = YES; 212 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 213 | GCC_WARN_UNUSED_FUNCTION = YES; 214 | GCC_WARN_UNUSED_VARIABLE = YES; 215 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 216 | MTL_ENABLE_DEBUG_INFO = YES; 217 | ONLY_ACTIVE_ARCH = YES; 218 | SDKROOT = iphoneos; 219 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 220 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 221 | TARGETED_DEVICE_FAMILY = "1,2"; 222 | }; 223 | name = Debug; 224 | }; 225 | 17E7C5091E252729003C2F58 /* Release */ = { 226 | isa = XCBuildConfiguration; 227 | buildSettings = { 228 | ALWAYS_SEARCH_USER_PATHS = NO; 229 | CLANG_ANALYZER_NONNULL = YES; 230 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 231 | CLANG_CXX_LIBRARY = "libc++"; 232 | CLANG_ENABLE_MODULES = YES; 233 | CLANG_ENABLE_OBJC_ARC = YES; 234 | CLANG_WARN_BOOL_CONVERSION = YES; 235 | CLANG_WARN_CONSTANT_CONVERSION = YES; 236 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 237 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 238 | CLANG_WARN_EMPTY_BODY = YES; 239 | CLANG_WARN_ENUM_CONVERSION = YES; 240 | CLANG_WARN_INFINITE_RECURSION = YES; 241 | CLANG_WARN_INT_CONVERSION = YES; 242 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 243 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 244 | CLANG_WARN_UNREACHABLE_CODE = YES; 245 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 246 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 247 | COPY_PHASE_STRIP = NO; 248 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 249 | ENABLE_NS_ASSERTIONS = NO; 250 | ENABLE_STRICT_OBJC_MSGSEND = YES; 251 | GCC_C_LANGUAGE_STANDARD = gnu99; 252 | GCC_NO_COMMON_BLOCKS = YES; 253 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 254 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 255 | GCC_WARN_UNDECLARED_SELECTOR = YES; 256 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 257 | GCC_WARN_UNUSED_FUNCTION = YES; 258 | GCC_WARN_UNUSED_VARIABLE = YES; 259 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 260 | MTL_ENABLE_DEBUG_INFO = NO; 261 | SDKROOT = iphoneos; 262 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 263 | TARGETED_DEVICE_FAMILY = "1,2"; 264 | VALIDATE_PRODUCT = YES; 265 | }; 266 | name = Release; 267 | }; 268 | 17E7C50B1E252729003C2F58 /* Debug */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 272 | DEVELOPMENT_TEAM = CJESF9R9MD; 273 | INFOPLIST_FILE = MTPhotosGallery/Info.plist; 274 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 275 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 276 | PRODUCT_BUNDLE_IDENTIFIER = com.test.manektechMTPhotosGallery; 277 | PRODUCT_NAME = "$(TARGET_NAME)"; 278 | PROVISIONING_PROFILE = "e8c17819-16e4-4444-88a1-a8a781227af3"; 279 | PROVISIONING_PROFILE_SPECIFIER = WildcardTest; 280 | SWIFT_VERSION = 3.0; 281 | TARGETED_DEVICE_FAMILY = 1; 282 | }; 283 | name = Debug; 284 | }; 285 | 17E7C50C1E252729003C2F58 /* Release */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | DEVELOPMENT_TEAM = CJESF9R9MD; 290 | INFOPLIST_FILE = MTPhotosGallery/Info.plist; 291 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 292 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 293 | PRODUCT_BUNDLE_IDENTIFIER = com.test.manektechMTPhotosGallery; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | PROVISIONING_PROFILE = "e8c17819-16e4-4444-88a1-a8a781227af3"; 296 | PROVISIONING_PROFILE_SPECIFIER = WildcardTest; 297 | SWIFT_VERSION = 3.0; 298 | TARGETED_DEVICE_FAMILY = 1; 299 | }; 300 | name = Release; 301 | }; 302 | /* End XCBuildConfiguration section */ 303 | 304 | /* Begin XCConfigurationList section */ 305 | 17E7C4F01E252729003C2F58 /* Build configuration list for PBXProject "MTPhotosGallery" */ = { 306 | isa = XCConfigurationList; 307 | buildConfigurations = ( 308 | 17E7C5081E252729003C2F58 /* Debug */, 309 | 17E7C5091E252729003C2F58 /* Release */, 310 | ); 311 | defaultConfigurationIsVisible = 0; 312 | defaultConfigurationName = Release; 313 | }; 314 | 17E7C50A1E252729003C2F58 /* Build configuration list for PBXNativeTarget "MTPhotosGallery" */ = { 315 | isa = XCConfigurationList; 316 | buildConfigurations = ( 317 | 17E7C50B1E252729003C2F58 /* Debug */, 318 | 17E7C50C1E252729003C2F58 /* Release */, 319 | ); 320 | defaultConfigurationIsVisible = 0; 321 | defaultConfigurationName = Release; 322 | }; 323 | /* End XCConfigurationList section */ 324 | 325 | /* Begin XCVersionGroup section */ 326 | 17E7C4FF1E252729003C2F58 /* MTPhotosGallery.xcdatamodeld */ = { 327 | isa = XCVersionGroup; 328 | children = ( 329 | 17E7C5001E252729003C2F58 /* MTPhotosGallery.xcdatamodel */, 330 | ); 331 | currentVersion = 17E7C5001E252729003C2F58 /* MTPhotosGallery.xcdatamodel */; 332 | path = MTPhotosGallery.xcdatamodeld; 333 | sourceTree = ""; 334 | versionGroupType = wrapper.xcdatamodel; 335 | }; 336 | /* End XCVersionGroup section */ 337 | }; 338 | rootObject = 17E7C4ED1E252729003C2F58 /* Project object */; 339 | } 340 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery.xcodeproj/project.xcworkspace/xcuserdata/devubhamanek.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery.xcodeproj/project.xcworkspace/xcuserdata/devubhamanek.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery.xcodeproj/xcuserdata/devubhamanek.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery.xcodeproj/xcuserdata/devubhamanek.xcuserdatad/xcschemes/MTPhotosGallery.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery.xcodeproj/xcuserdata/devubhamanek.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MTPhotosGallery.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 17E7C4F41E252729003C2F58 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import CoreData 3 | 4 | @UIApplicationMain 5 | class AppDelegate: UIResponder, UIApplicationDelegate { 6 | 7 | var window: UIWindow? 8 | 9 | 10 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 11 | // Override point for customization after application launch. 12 | return true 13 | } 14 | 15 | func applicationWillResignActive(_ application: UIApplication) { 16 | // 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. 17 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 18 | } 19 | 20 | func applicationDidEnterBackground(_ application: UIApplication) { 21 | // 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. 22 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 23 | } 24 | 25 | func applicationWillEnterForeground(_ application: UIApplication) { 26 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 27 | } 28 | 29 | func applicationDidBecomeActive(_ application: UIApplication) { 30 | // 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. 31 | } 32 | 33 | func applicationWillTerminate(_ application: UIApplication) { 34 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 35 | // Saves changes in the application's managed object context before the application terminates. 36 | self.saveContext() 37 | } 38 | 39 | // MARK: - Core Data stack 40 | 41 | @available(iOS 10.0, *) 42 | lazy var persistentContainer: NSPersistentContainer = { 43 | /* 44 | The persistent container for the application. This implementation 45 | creates and returns a container, having loaded the store for the 46 | application to it. This property is optional since there are legitimate 47 | error conditions that could cause the creation of the store to fail. 48 | */ 49 | let container = NSPersistentContainer(name: "MTPhotosGallery") 50 | container.loadPersistentStores(completionHandler: { (storeDescription, error) in 51 | if let error = error as NSError? { 52 | // Replace this implementation with code to handle the error appropriately. 53 | // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 54 | 55 | /* 56 | Typical reasons for an error here include: 57 | * The parent directory does not exist, cannot be created, or disallows writing. 58 | * The persistent store is not accessible, due to permissions or data protection when the device is locked. 59 | * The device is out of space. 60 | * The store could not be migrated to the current model version. 61 | Check the error message to determine what the actual problem was. 62 | */ 63 | fatalError("Unresolved error \(error), \(error.userInfo)") 64 | } 65 | }) 66 | return container 67 | }() 68 | 69 | // MARK: - Core Data Saving support 70 | 71 | func saveContext () { 72 | /* if #available(iOS 10.0, *) { 73 | let context = persistentContainer.viewContext 74 | } else { 75 | // Fallback on earlier versions 76 | } 77 | if context.hasChanges { 78 | do { 79 | try context.save() 80 | } catch { 81 | // Replace this implementation with code to handle the error appropriately. 82 | // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 83 | let nserror = error as NSError 84 | fatalError("Unresolved error \(nserror), \(nserror.userInfo)") 85 | } 86 | }*/ 87 | } 88 | 89 | } 90 | 91 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-40x40@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-60x60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "20x20", 53 | "idiom" : "ipad", 54 | "filename" : "Icon-App-20x20@1x.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@2x-1.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-29x29@1x.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@2x-1.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-40x40@1x.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@2x-1.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-76x76@1x.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@2x.png", 97 | "scale" : "2x" 98 | }, 99 | { 100 | "size" : "83.5x83.5", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-83.5x83.5@2x.png", 103 | "scale" : "2x" 104 | } 105 | ], 106 | "info" : { 107 | "version" : 1, 108 | "author" : "xcode" 109 | } 110 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x-1.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x-1.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x-1.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgBackground1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgBackground1.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgBackground1.imageset/imgBackground1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgBackground1.imageset/imgBackground1.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum1.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum1.imageset/imgPhotosAlbum1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum1.imageset/imgPhotosAlbum1.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum10.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum10.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum10.imageset/imgPhotosAlbum10.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum10.imageset/imgPhotosAlbum10.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum11.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum11.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum11.imageset/imgPhotosAlbum11.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum11.imageset/imgPhotosAlbum11.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum12.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum12.jpg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum12.imageset/imgPhotosAlbum12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum12.imageset/imgPhotosAlbum12.jpg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum2.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum2.imageset/imgPhotosAlbum2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum2.imageset/imgPhotosAlbum2.png -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum3.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum3.imageset/imgPhotosAlbum3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum3.imageset/imgPhotosAlbum3.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum4.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum4.imageset/imgPhotosAlbum4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum4.imageset/imgPhotosAlbum4.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum5.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum5.imageset/imgPhotosAlbum5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum5.imageset/imgPhotosAlbum5.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum6.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum6.imageset/imgPhotosAlbum6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum6.imageset/imgPhotosAlbum6.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum7.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum7.imageset/imgPhotosAlbum7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum7.imageset/imgPhotosAlbum7.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum8.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum8.imageset/imgPhotosAlbum8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum8.imageset/imgPhotosAlbum8.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "imgPhotosAlbum9.jpeg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum9.imageset/imgPhotosAlbum9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekdilip/MTPhotosGallery/89f5c4a1751be24af28c9b41daf5f0f7641e3c81/Project/MTPhotosGallery/MTPhotosGallery/Assets.xcassets/imgPhotosAlbum9.imageset/imgPhotosAlbum9.jpeg -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/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 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/MTPhotosGallery.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | MTPhotosGallery.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/MTPhotosGallery.xcdatamodeld/MTPhotosGallery.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/PhotosGalleryView.swift: -------------------------------------------------------------------------------- 1 | import AVFoundation 2 | 3 | let MAXIMUM_SCALE:CGFloat = CGFloat(3.0) 4 | let MINIMUM_SCALE:CGFloat = CGFloat(1.0) 5 | 6 | import UIKit 7 | //MARK: - Photos Cell Create 8 | class CellPhotosHeaderImage: UICollectionViewCell { 9 | var imageThumb:UIImageView! 10 | var lblConter:UILabel! 11 | override init(frame: CGRect) { 12 | super.init(frame: frame) 13 | 14 | imageThumb = UIImageView(frame: CGRect(x: 0,y: 0,width : 1,height: 1)) 15 | self.addSubview(imageThumb) 16 | 17 | lblConter = UILabel(frame: CGRect(x: 0,y: 0,width : 1,height: 1)) 18 | lblConter.font = UIFont.init(name: "Arial", size: 25) 19 | lblConter.textAlignment = .center 20 | lblConter.textColor = .black 21 | lblConter.isHidden = true 22 | self.addSubview(lblConter) 23 | } 24 | required init?(coder aDecoder: NSCoder) { 25 | fatalError("init(coder:) has not been implemented") 26 | } 27 | } 28 | class CellPhotosImage: UICollectionViewCell, UIScrollViewDelegate { 29 | var lblConter:UILabel! 30 | var imageBig:UIImageView! 31 | var scrollImageBG:UIScrollView! 32 | 33 | override init(frame: CGRect) { 34 | super.init(frame: frame) 35 | 36 | imageBig = UIImageView(frame: CGRect(x: 0,y: 0,width : 1,height: 1)) 37 | imageBig.backgroundColor = .blue 38 | imageBig.contentMode = .top 39 | imageBig.clipsToBounds = true 40 | imageBig.backgroundColor = .clear 41 | 42 | scrollImageBG = UIScrollView(frame: CGRect(x: 0,y: 0,width: 1,height: 1)) 43 | scrollImageBG.backgroundColor = .clear 44 | scrollImageBG.autoresizingMask = [.flexibleWidth, .flexibleHeight] 45 | scrollImageBG.maximumZoomScale = MAXIMUM_SCALE 46 | scrollImageBG.minimumZoomScale = MINIMUM_SCALE 47 | scrollImageBG.clipsToBounds = true 48 | scrollImageBG.delegate = self 49 | self.addSubview(scrollImageBG) 50 | scrollImageBG.addSubview(imageBig) 51 | 52 | lblConter = UILabel(frame: CGRect(x: 0,y: 0,width : 1,height: 1)) 53 | lblConter.font = UIFont.init(name: "Arial", size: 25) 54 | lblConter.textColor = .black 55 | lblConter.textAlignment = .center 56 | lblConter.isUserInteractionEnabled = false 57 | lblConter.isHidden = true 58 | self.addSubview(lblConter) 59 | 60 | self.setup() 61 | } 62 | required init?(coder aDecoder: NSCoder) { 63 | fatalError("init(coder:) has not been implemented") 64 | } 65 | func setup() { 66 | let tapGestureRecognizer:UITapGestureRecognizer = UITapGestureRecognizer.init(target: self, action: #selector(CellPhotosImage.handleDoubleTap)) 67 | tapGestureRecognizer.numberOfTapsRequired = 2 68 | 69 | let pinchGestureRecognizer: UIPinchGestureRecognizer = UIPinchGestureRecognizer.init(target: self, action: #selector(CellPhotosImage.zoomImage)) 70 | 71 | self.imageBig.gestureRecognizers = [pinchGestureRecognizer,tapGestureRecognizer] 72 | self.imageBig.isUserInteractionEnabled = true 73 | self.scrollImageBG.delegate = self 74 | } 75 | func viewForZooming(in scrollView: UIScrollView) -> UIView? { 76 | return self.imageBig 77 | } 78 | func zoomImage(gesture: UIPinchGestureRecognizer) { 79 | if (gesture.state == UIGestureRecognizerState.ended || gesture.state == UIGestureRecognizerState.changed) { 80 | 81 | let currentScale:CGFloat = self.frame.size.width / self.bounds.size.width 82 | var newScale:CGFloat = currentScale * gesture.scale 83 | 84 | if (newScale < MINIMUM_SCALE) { 85 | newScale = MINIMUM_SCALE 86 | } 87 | if (newScale > MAXIMUM_SCALE) { 88 | newScale = MAXIMUM_SCALE 89 | } 90 | } 91 | } 92 | func handleDoubleTap(gestureRecognizer: UIGestureRecognizer) { 93 | if scrollImageBG.zoomScale > scrollImageBG.minimumZoomScale { 94 | scrollImageBG.setZoomScale(scrollImageBG.minimumZoomScale, animated: true) 95 | UserDefaults.standard.set(scrollImageBG.minimumZoomScale, forKey: "PhotoZoomingScale") 96 | UserDefaults.standard.synchronize() 97 | 98 | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "startAutoAnimationTimerNotification"), object: nil) 99 | } 100 | else { 101 | scrollImageBG.setZoomScale(scrollImageBG.maximumZoomScale, animated: true) 102 | UserDefaults.standard.set(scrollImageBG.maximumZoomScale, forKey: "PhotoZoomingScale") 103 | UserDefaults.standard.synchronize() 104 | 105 | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "stopAutoAnimationNotification"), object: nil) 106 | } 107 | } 108 | func scrollViewWillBeginZooming(_ scrollView: UIScrollView, with view: UIView?) { 109 | UserDefaults.standard.set(1.1, forKey: "PhotoZoomingScale") 110 | UserDefaults.standard.synchronize() 111 | 112 | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "stopAutoAnimationNotification"), object: nil) 113 | } 114 | func scrollViewDidEndZooming(_ scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat) { 115 | UserDefaults.standard.set(scale, forKey: "PhotoZoomingScale") 116 | UserDefaults.standard.synchronize() 117 | 118 | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "startAutoAnimationTimerNotification"), object: nil) 119 | } 120 | } 121 | class PhotosGalleryView: UIView, UICollectionViewDelegate, UICollectionViewDataSource { 122 | //MARK: - Variable Declaration 123 | //Header Gallery 124 | var collectionHeaderImage:UICollectionView! 125 | var widthCellHeader:CGFloat! 126 | var indexOfHeaderFirstCell = 0 127 | var pointHeaderFirstCell:CGPoint! 128 | 129 | //Footer Gallery 130 | var collectionImage:UICollectionView! 131 | var widthCellFooter:CGFloat! 132 | var timerFooterCollectionViewAnimation:Timer! 133 | var indexOfFooterVisibleCell:IndexPath! 134 | var scrollViewFooter:UIScrollView! 135 | 136 | var arrImagesData = [GalleryDataImages]() 137 | var indexHeaderCell = -1 138 | 139 | //MARK: - Override Method 140 | override init(frame: CGRect) { 141 | super.init(frame: frame) 142 | //Stop Auto Animation 143 | NotificationCenter.default.addObserver(self, selector: #selector(PhotosGalleryView.stopAutoAnimation), name: NSNotification.Name(rawValue: "stopAutoAnimationNotification"), object: nil) 144 | //Start Auto Animation 145 | NotificationCenter.default.addObserver(self, selector: #selector(PhotosGalleryView.startAutoAnimationTimer), name: NSNotification.Name(rawValue: "startAutoAnimationTimerNotification"), object: nil) 146 | 147 | self.backgroundColor = .clear 148 | pointHeaderFirstCell = CGPoint(x: 0, y: 0) 149 | 150 | UserDefaults.standard.set(MINIMUM_SCALE, forKey: "PhotoZoomingScale") 151 | UserDefaults.standard.synchronize() 152 | 153 | //Header Photos 154 | let flowLayoutHeader = UICollectionViewFlowLayout() 155 | flowLayoutHeader.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) 156 | widthCellHeader = (self.frame.size.width - 35) / 4.0 157 | flowLayoutHeader.itemSize = CGSize(width: widthCellHeader, height: 71) 158 | flowLayoutHeader.scrollDirection = .horizontal 159 | 160 | collectionHeaderImage = UICollectionView(frame: CGRect(x: 2.5,y: 0,width: frame.size.width - 5,height: 71), collectionViewLayout: flowLayoutHeader) 161 | collectionHeaderImage.delegate = self 162 | collectionHeaderImage.dataSource = self 163 | collectionHeaderImage.register(CellPhotosHeaderImage.self, forCellWithReuseIdentifier: "CellPhotosHeaderImage") 164 | collectionHeaderImage.showsVerticalScrollIndicator = false 165 | collectionHeaderImage.showsHorizontalScrollIndicator = false 166 | collectionHeaderImage.backgroundColor = .clear 167 | self.addSubview(collectionHeaderImage) 168 | 169 | //Footer Photos 170 | let flowLayoutFooter = UICollectionViewFlowLayout() 171 | flowLayoutFooter.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) 172 | widthCellFooter = (self.frame.size.width) / 1.0 173 | flowLayoutFooter.minimumLineSpacing = 0.0 174 | flowLayoutFooter.minimumInteritemSpacing = 0.0 175 | flowLayoutFooter.itemSize = CGSize(width: widthCellFooter, height: (frame.size.height - (collectionHeaderImage.frame.origin.y + collectionHeaderImage.frame.size.height + 10))) 176 | flowLayoutFooter.scrollDirection = .horizontal 177 | 178 | collectionImage = UICollectionView(frame: CGRect(x: 0,y: collectionHeaderImage.frame.origin.y + collectionHeaderImage.frame.size.height + 5,width: frame.size.width,height: (frame.size.height - (collectionHeaderImage.frame.origin.y + collectionHeaderImage.frame.size.height + 0))), collectionViewLayout: flowLayoutFooter) 179 | collectionImage.delegate = self 180 | collectionImage.dataSource = self 181 | collectionImage.register(CellPhotosImage.self, forCellWithReuseIdentifier: "CellPhotosImage") 182 | collectionImage.showsVerticalScrollIndicator = false 183 | collectionImage.showsHorizontalScrollIndicator = false 184 | collectionImage.isPagingEnabled = true 185 | collectionImage.backgroundColor = .clear 186 | self.addSubview(collectionImage) 187 | 188 | self.startAutoAnimationTimer() 189 | } 190 | required init?(coder aDecoder: NSCoder) { 191 | fatalError("init(coder:) has not been implemented") 192 | } 193 | //MARK: - UICollectionView Delegate / Data Sources 194 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 195 | return arrImagesData.count 196 | } 197 | @available(iOS 6.0, *) 198 | public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 199 | /* 200 | -> Don’t perform data binding at cellForItemAt method. 201 | -> B'coz because there’s no cell on screen yet. 202 | -> Just get the reuse cell from catch or create new and return immediately. this increase calling frequency of this method. 203 | -> For data binding you can use willDisplay method. 204 | */ 205 | 206 | if collectionHeaderImage == collectionView { 207 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CellPhotosHeaderImage", for: indexPath) as! CellPhotosHeaderImage 208 | return cell 209 | } 210 | else { 211 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CellPhotosImage", for: indexPath) as! CellPhotosImage 212 | 213 | cell.scrollImageBG.zoomScale = MINIMUM_SCALE 214 | let transform:CGAffineTransform = CGAffineTransform(scaleX: MINIMUM_SCALE, y: MINIMUM_SCALE) 215 | cell.imageBig.transform = transform 216 | cell.scrollImageBG.contentOffset = CGPoint.zero 217 | 218 | return cell 219 | } 220 | } 221 | func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { 222 | //Header Collection View 223 | if let cellPhotosHeaderImage = cell as? CellPhotosHeaderImage { 224 | cellPhotosHeaderImage.imageThumb.frame = CGRect(x: 0,y: 0,width: cell.frame.size.width,height: cell.frame.size.height) 225 | cellPhotosHeaderImage.imageThumb.clipsToBounds = true 226 | cellPhotosHeaderImage.imageThumb.backgroundColor = .clear 227 | 228 | cellPhotosHeaderImage.imageThumb.image = arrImagesData[indexPath.row].image_src 229 | cellPhotosHeaderImage.imageThumb.contentMode = .scaleAspectFill 230 | 231 | /*let strImageName:String = WebURL.getAudioAlbumThumbBaseURL + arrImagesData[indexPath.row].image_src 232 | var isImageAvailable = false 233 | cellPhotosHeaderImage.imageThumb.sd_setImage(with: NSURL(string: strImageName) as URL!, completed: { (image, error, SDImageCacheType, URL) in 234 | if image != nil 235 | { 236 | isImageAvailable = true 237 | cellPhotosHeaderImage.imageThumb.image = image 238 | cellPhotosHeaderImage.imageThumb.contentMode = .scaleAspectFill 239 | } 240 | }) 241 | if isImageAvailable == false { 242 | cellPhotosHeaderImage.imageThumb.image = #imageLiteral(resourceName: "imgHomeHeadphone") 243 | cellPhotosHeaderImage.imageThumb.contentMode = .scaleAspectFit 244 | }*/ 245 | 246 | cellPhotosHeaderImage.backgroundColor = .clear 247 | cellPhotosHeaderImage.lblConter.frame = CGRect(x: 0,y: 0,width: cell.frame.size.width,height: cell.frame.size.height) 248 | cellPhotosHeaderImage.lblConter.text = "\(indexPath.row+1)" 249 | } 250 | //Footer Collection View 251 | else if let cellPhotosImage = cell as? CellPhotosImage { 252 | cellPhotosImage.lblConter.frame = CGRect(x: 0,y: 0,width: cell.frame.size.width,height: cell.frame.size.height) 253 | cellPhotosImage.lblConter.text = "\(indexPath.row+1)" 254 | indexOfFooterVisibleCell = indexPath 255 | cellPhotosImage.backgroundColor = .clear 256 | 257 | cellPhotosImage.scrollImageBG.zoomScale = MINIMUM_SCALE 258 | let transform:CGAffineTransform = CGAffineTransform(scaleX: MINIMUM_SCALE, y: MINIMUM_SCALE) 259 | cellPhotosImage.imageBig.transform = transform 260 | cellPhotosImage.scrollImageBG.contentOffset = CGPoint.zero 261 | cellPhotosImage.scrollImageBG.frame = CGRect(x: 0,y: 0,width: cell.frame.size.width,height: cell.frame.size.height) 262 | cellPhotosImage.scrollImageBG.contentSize = CGSize(width: cell.frame.size.width, height: cell.frame.size.height) 263 | cellPhotosImage.imageBig.frame = CGRect(x: 2.5,y: 0,width: cell.frame.size.width - 5.0,height: cell.frame.size.height) 264 | 265 | //================ 266 | cellPhotosImage.imageBig.image = arrImagesData[indexPath.row].image_src 267 | cellPhotosImage.imageBig.backgroundColor = .clear 268 | cellPhotosImage.imageBig.contentMode = .scaleAspectFill 269 | 270 | let heightInPoints = arrImagesData[indexPath.row].image_src.size.height 271 | let heightInPixels = heightInPoints * (arrImagesData[indexPath.row].image_src.scale) 272 | let widthInPoints = arrImagesData[indexPath.row].image_src.size.width 273 | let widthInPixels = widthInPoints * (arrImagesData[indexPath.row].image_src.scale) 274 | 275 | cellPhotosImage.imageBig.frame = CGRect(x: cellPhotosImage.imageBig.frame.origin.x,y: cellPhotosImage.imageBig.frame.origin.y,width: (cell.frame.size.width - 5.0 > widthInPixels ? widthInPixels : cell.frame.size.width - 5.0),height: (cell.frame.size.height > heightInPixels ? heightInPixels : cell.frame.size.height)) 276 | cellPhotosImage.scrollImageBG.contentSize = cellPhotosImage.imageBig.frame.size 277 | 278 | //================ 279 | 280 | /*let strImageName:String = WebURL.getAudioAlbumThumbBaseURL + arrImagesData[indexPath.row].image_src 281 | var isImageAvailable = false 282 | cellPhotosImage.imageBig.sd_setImage(with: NSURL(string: strImageName) as URL!, completed: { (image, error, SDImageCacheType, URL) in 283 | if image != nil { 284 | isImageAvailable = true 285 | cellPhotosImage.imageBig.image = image 286 | cellPhotosImage.imageBig.backgroundColor = .clear 287 | cellPhotosImage.imageBig.contentMode = .scaleAspectFill 288 | 289 | let heightInPoints = image?.size.height 290 | let heightInPixels = heightInPoints! * (image?.scale)! 291 | let widthInPoints = image?.size.width 292 | let widthInPixels = widthInPoints! * (image?.scale)! 293 | 294 | cellPhotosImage.imageBig.frame = CGRect(x: cellPhotosImage.imageBig.frame.origin.x,y: cellPhotosImage.imageBig.frame.origin.y,width: (cell.frame.size.width - 5.0 > widthInPixels ? widthInPixels : cell.frame.size.width - 5.0),height: (cell.frame.size.height > heightInPixels ? heightInPixels : cell.frame.size.height)) 295 | cellPhotosImage.scrollImageBG.contentSize = cellPhotosImage.imageBig.frame.size 296 | } 297 | }) 298 | if isImageAvailable == false { 299 | cellPhotosImage.imageBig.contentMode = .scaleAspectFit 300 | cellPhotosImage.imageBig.image = #imageLiteral(resourceName: "imgHomeScreenLemonLogo") 301 | cellPhotosImage.scrollImageBG.contentSize = cellPhotosImage.imageBig.frame.size 302 | }*/ 303 | cellPhotosImage.backgroundColor = .clear 304 | } 305 | } 306 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 307 | //Header Collection View Selected Item 308 | if collectionHeaderImage == collectionView { 309 | if (self.getFooterCellVisible().row - 1) != indexPath.row { 310 | UserDefaults.standard.set(MINIMUM_SCALE, forKey: "PhotoZoomingScale") 311 | UserDefaults.standard.synchronize() 312 | } 313 | 314 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(cellFooterMoveToPerticularIndex), object: nil) 315 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(cellHeaderMoveToPerticularIndex), object: nil) 316 | 317 | if timerFooterCollectionViewAnimation != nil { 318 | timerFooterCollectionViewAnimation.invalidate() 319 | timerFooterCollectionViewAnimation = nil 320 | } 321 | indexOfFooterVisibleCell = indexPath 322 | self.cellHeaderMoveToPerticularIndex() 323 | 324 | self.startAutoAnimationTimer() 325 | collectionImage.scrollToItem(at: indexPath, at: UICollectionViewScrollPosition.centeredHorizontally, animated: true) 326 | } 327 | //Footer Collection View Selected Item 328 | else if collectionImage == collectionView { 329 | print("Footer image : \(indexPath.row)") 330 | } 331 | } 332 | //MARK: - Scroll View Delegate Method 333 | func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { 334 | indexHeaderCell = self.getHeaderFirstCellIndex().row 335 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(cellFooterMoveToPerticularIndex), object: nil) 336 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(cellHeaderMoveToPerticularIndex), object: nil) 337 | 338 | if timerFooterCollectionViewAnimation != nil { 339 | timerFooterCollectionViewAnimation.invalidate() 340 | timerFooterCollectionViewAnimation = nil 341 | } 342 | } 343 | func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) { 344 | 345 | if scrollView == collectionHeaderImage { 346 | let pageWidth: Float = Float((collectionHeaderImage.frame.size.width + 10) / 4.0) 347 | let currentOffset: Float = Float(scrollView.contentOffset.x) 348 | let targetOffset: Float = Float(targetContentOffset.pointee.x) 349 | var newTargetOffset: Float = 0 350 | if targetOffset > currentOffset { 351 | newTargetOffset = ceilf(currentOffset / pageWidth) * pageWidth 352 | } 353 | else { 354 | newTargetOffset = floorf(currentOffset / pageWidth) * pageWidth 355 | } 356 | if newTargetOffset < 0 { 357 | newTargetOffset = 0 358 | } 359 | else if (newTargetOffset > Float(scrollView.contentSize.width)){ 360 | newTargetOffset = Float(Float(scrollView.contentSize.width)) 361 | } 362 | 363 | targetContentOffset.pointee.x = CGFloat(currentOffset) 364 | pointHeaderFirstCell = CGPoint(x: CGFloat(newTargetOffset), y: scrollView.contentOffset.y) 365 | scrollView.setContentOffset(CGPoint(x: CGFloat(newTargetOffset), y: scrollView.contentOffset.y), animated: true) 366 | 367 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(cellFooterMoveToPerticularIndex), object: nil) 368 | self.perform(#selector(cellFooterMoveToPerticularIndex), with: nil, afterDelay: 0.5) 369 | } 370 | else if scrollView == collectionImage { 371 | if self.isImageZooming() == false { 372 | self.startAutoAnimationTimer() 373 | } 374 | 375 | if velocity.x != 0.0 { 376 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(cellHeaderMoveToPerticularIndex), object: nil) 377 | self.perform(#selector(cellHeaderMoveToPerticularIndex), with: nil, afterDelay: 0.5) 378 | } 379 | } 380 | } 381 | func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { 382 | print("scrollViewDidEndScrollingAnimation") 383 | UserDefaults.standard.set(MINIMUM_SCALE, forKey: "PhotoZoomingScale") 384 | UserDefaults.standard.synchronize() 385 | self.startAutoAnimationTimer() 386 | } 387 | func cellFooterMoveToPerticularIndex() { 388 | if indexHeaderCell != self.getHeaderFirstCellIndex().row { 389 | UserDefaults.standard.set(MINIMUM_SCALE, forKey: "PhotoZoomingScale") 390 | UserDefaults.standard.synchronize() 391 | } 392 | self.startAutoAnimationTimer() 393 | collectionImage.scrollToItem(at: self.getHeaderFirstCellIndex(), at: UICollectionViewScrollPosition.centeredHorizontally, animated: true) 394 | } 395 | func cellHeaderMoveToPerticularIndex() { 396 | collectionHeaderImage.scrollToItem(at: indexOfFooterVisibleCell, at: UICollectionViewScrollPosition.left, animated: true) 397 | } 398 | func getHeaderFirstCellIndex() -> IndexPath { 399 | var indexPath = collectionHeaderImage.indexPathForItem(at: pointHeaderFirstCell) 400 | if indexPath == nil { 401 | indexPath = IndexPath(item: arrImagesData.count - 1, section: 0) 402 | } 403 | return indexPath! 404 | } 405 | func getFooterCellVisible() -> IndexPath { 406 | let indexPath = IndexPath(row: arrImagesData.count == indexOfFooterVisibleCell.row + 1 ? indexOfFooterVisibleCell.row : indexOfFooterVisibleCell.row + 1, section: indexOfFooterVisibleCell.section) 407 | return indexPath 408 | } 409 | func scrollToNextCell() { 410 | if self.isImageZooming() == true { 411 | return 412 | } 413 | 414 | //get Collection View Instance 415 | let _:UICollectionView; 416 | 417 | //get cell size 418 | let cellSize = CGSize(width: widthCellFooter, height: (frame.size.height - (collectionHeaderImage.frame.origin.y + collectionHeaderImage.frame.size.height + 10))); 419 | 420 | //get current content Offset of the Collection view 421 | let contentOffset = collectionImage.contentOffset; 422 | 423 | //scroll to next cell 424 | collectionImage.scrollRectToVisible(CGRect(x: contentOffset.x + cellSize.width,y: contentOffset.y,width: cellSize.width,height: cellSize.height), animated: true); 425 | 426 | collectionHeaderImage.scrollToItem(at: self.getFooterCellVisible(), at: UICollectionViewScrollPosition.left, animated: true) 427 | } 428 | func startAutoAnimationTimer() { 429 | if timerFooterCollectionViewAnimation != nil { 430 | timerFooterCollectionViewAnimation.invalidate() 431 | timerFooterCollectionViewAnimation = nil 432 | } 433 | 434 | timerFooterCollectionViewAnimation = Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(PhotosGalleryView.scrollToNextCell), userInfo: nil, repeats: true); 435 | } 436 | func stopAutoAnimation() { 437 | if self.timerFooterCollectionViewAnimation != nil { 438 | self.timerFooterCollectionViewAnimation.invalidate() 439 | self.timerFooterCollectionViewAnimation = nil 440 | } 441 | } 442 | //MARK: - Show 443 | func show(view: UIView,arrImagesListModel: [GalleryDataImages]) -> UIView { 444 | view.addSubview(self) 445 | arrImagesData.removeAll() 446 | arrImagesData = arrImagesListModel 447 | collectionHeaderImage.reloadData() 448 | collectionImage.reloadData() 449 | return self 450 | } 451 | func isImageZooming() -> Bool { 452 | if let scale = UserDefaults.standard.object(forKey: "PhotoZoomingScale") { 453 | let fltScale:CGFloat = scale as! CGFloat 454 | if fltScale != MINIMUM_SCALE { 455 | return true 456 | } 457 | } 458 | return false 459 | } 460 | } 461 | -------------------------------------------------------------------------------- /Project/MTPhotosGallery/MTPhotosGallery/ViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | //MARK: - Model Class 4 | class GalleryDataImages { 5 | var image_src:UIImage = UIImage() 6 | 7 | //Allock memory and data 8 | init(image_src:UIImage) { 9 | self.image_src = image_src 10 | } 11 | } 12 | 13 | //MARK: - Controller Class 14 | class ViewController: UIViewController { 15 | 16 | var photosGalleryViewObj:PhotosGalleryView! 17 | var arrImagesListModel = [GalleryDataImages]() 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | 22 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum1"))) 23 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum2"))) 24 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum3"))) 25 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum4"))) 26 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum5"))) 27 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum6"))) 28 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum7"))) 29 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum8"))) 30 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum9"))) 31 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum10"))) 32 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum11"))) 33 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum12"))) 34 | 35 | //Photo Gallery View Create 36 | photosGalleryViewObj = PhotosGalleryView.init(frame: CGRect(x: 0,y: 50,width: self.view.frame.size.width,height: self.view.frame.size.height - 50)).show(view: self.view, arrImagesListModel: arrImagesListModel) as! PhotosGalleryView 37 | } 38 | override func didReceiveMemoryWarning() { 39 | super.didReceiveMemoryWarning() 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MTPhotosGallery 2 | Create photos gallery view with auto animation and zooming functionality. 3 | MTPhotosGallery written in Swift 3.0 and easy to use in project. 4 | 5 | ![BackgroundImage](https://github.com/manekdilip/MTPhotosGallery/blob/master/Images/MTPhotosGallery.gif) 6 | 7 | #Installation 8 | 9 | ### Manually 10 | 11 | Clone or Download this Repo. Then simply drag the class ```PhotosGalleryView.swift``` to your Xcode project. 12 | 13 | 14 | ###Simply way to integrate ```MTPhotosGallery``` 15 | 16 | ###Create ```PhotosGalleryView``` in ```ViewController``` 17 | 18 | ``` 19 | class ViewController: UIViewController { 20 | 21 | var photosGalleryViewObj:PhotosGalleryView! 22 | var arrImagesListModel = [GalleryDataImages]() 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | 27 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum1"))) 28 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum2"))) 29 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum3"))) 30 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum4"))) 31 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum5"))) 32 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum6"))) 33 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum7"))) 34 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum8"))) 35 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum9"))) 36 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum10"))) 37 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum11"))) 38 | arrImagesListModel.append(GalleryDataImages(image_src: #imageLiteral(resourceName: "imgPhotosAlbum12"))) 39 | 40 | //Photo Gallery View Create 41 | photosGalleryViewObj = PhotosGalleryView.init(frame: CGRect(x: 0,y: 50,width: self.view.frame.size.width,height: self.view.frame.size.height - 50)).show(view: self.view, arrImagesListModel: arrImagesListModel) as! PhotosGalleryView 42 | } 43 | } 44 | ``` 45 | --------------------------------------------------------------------------------