diff --git a/Default-568h@2x.png b/Default-568h@2x.png new file mode 100644 index 0000000..0891b7a Binary files /dev/null and b/Default-568h@2x.png differ diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000..5ee5996 --- /dev/null +++ b/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Storyboard + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/VideoThumbnailSelectionView.xcodeproj/project.pbxproj b/VideoThumbnailSelectionView.xcodeproj/project.pbxproj index d72c175..710691f 100644 --- a/VideoThumbnailSelectionView.xcodeproj/project.pbxproj +++ b/VideoThumbnailSelectionView.xcodeproj/project.pbxproj @@ -7,6 +7,18 @@ objects = { /* Begin PBXBuildFile section */ + A985FAC120FF6146003DC7D5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A985FAC020FF6146003DC7D5 /* AppDelegate.swift */; }; + A985FAC820FF6146003DC7D5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A985FAC720FF6146003DC7D5 /* Assets.xcassets */; }; + A985FACB20FF6146003DC7D5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A985FAC920FF6146003DC7D5 /* LaunchScreen.storyboard */; }; + A985FAD220FF61A1003DC7D5 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A985FAD020FF619D003DC7D5 /* HomeViewController.swift */; }; + A985FAD420FF62D8003DC7D5 /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A985FAD320FF62D8003DC7D5 /* Storyboard.storyboard */; }; + A985FAD520FF62D8003DC7D5 /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A985FAD320FF62D8003DC7D5 /* Storyboard.storyboard */; }; + A9DFBFD520FF71380000560F /* ScrollOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91E337F1D017B4F004EF96C /* ScrollOptions.swift */; }; + A9DFBFD620FF71380000560F /* SelectionThumb.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91E33801D017B4F004EF96C /* SelectionThumb.swift */; }; + A9DFBFD720FF71380000560F /* VideoThumbnailSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91E33811D017B4F004EF96C /* VideoThumbnailSelectionView.swift */; }; + A9DFBFD820FF71380000560F /* VideoThumbnailSelectionView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E91E33821D017B4F004EF96C /* VideoThumbnailSelectionView.xib */; }; + A9DFBFDC20FF74BA0000560F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9DFBFDB20FF74BA0000560F /* Default-568h@2x.png */; }; + A9DFBFDE20FF74D10000560F /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = A9DFBFDD20FF74D10000560F /* Info.plist */; }; E91E33781D017AB2004EF96C /* VideoThumbnailSelectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = E91E33771D017AB2004EF96C /* VideoThumbnailSelectionView.h */; settings = {ATTRIBUTES = (Public, ); }; }; E91E33831D017B4F004EF96C /* ScrollOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91E337F1D017B4F004EF96C /* ScrollOptions.swift */; }; E91E33841D017B4F004EF96C /* SelectionThumb.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91E33801D017B4F004EF96C /* SelectionThumb.swift */; }; @@ -15,9 +27,16 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + A985FABE20FF6146003DC7D5 /* vidThumb.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = vidThumb.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A985FAC020FF6146003DC7D5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A985FAC720FF6146003DC7D5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A985FACA20FF6146003DC7D5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + A985FAD020FF619D003DC7D5 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = ""; }; + A985FAD320FF62D8003DC7D5 /* Storyboard.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Storyboard.storyboard; sourceTree = ""; }; + A9DFBFDB20FF74BA0000560F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + A9DFBFDD20FF74D10000560F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; E91E33741D017AB2004EF96C /* VideoThumbnailSelectionView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = VideoThumbnailSelectionView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E91E33771D017AB2004EF96C /* VideoThumbnailSelectionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VideoThumbnailSelectionView.h; sourceTree = ""; }; - E91E33791D017AB2004EF96C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E91E337F1D017B4F004EF96C /* ScrollOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScrollOptions.swift; sourceTree = ""; }; E91E33801D017B4F004EF96C /* SelectionThumb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectionThumb.swift; sourceTree = ""; }; E91E33811D017B4F004EF96C /* VideoThumbnailSelectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoThumbnailSelectionView.swift; sourceTree = ""; }; @@ -25,6 +44,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + A985FABB20FF6146003DC7D5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; E91E33701D017AB2004EF96C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -38,6 +64,7 @@ E91E336A1D017AB2004EF96C = { isa = PBXGroup; children = ( + A9DFBFDB20FF74BA0000560F /* Default-568h@2x.png */, E91E33761D017AB2004EF96C /* VideoThumbnailSelectionView */, E91E33751D017AB2004EF96C /* Products */, ); @@ -47,6 +74,7 @@ isa = PBXGroup; children = ( E91E33741D017AB2004EF96C /* VideoThumbnailSelectionView.framework */, + A985FABE20FF6146003DC7D5 /* vidThumb.app */, ); name = Products; sourceTree = ""; @@ -54,12 +82,17 @@ E91E33761D017AB2004EF96C /* VideoThumbnailSelectionView */ = { isa = PBXGroup; children = ( + A985FAC020FF6146003DC7D5 /* AppDelegate.swift */, E91E337F1D017B4F004EF96C /* ScrollOptions.swift */, E91E33801D017B4F004EF96C /* SelectionThumb.swift */, E91E33811D017B4F004EF96C /* VideoThumbnailSelectionView.swift */, E91E33821D017B4F004EF96C /* VideoThumbnailSelectionView.xib */, E91E33771D017AB2004EF96C /* VideoThumbnailSelectionView.h */, - E91E33791D017AB2004EF96C /* Info.plist */, + A985FAD020FF619D003DC7D5 /* HomeViewController.swift */, + A985FAD320FF62D8003DC7D5 /* Storyboard.storyboard */, + A985FAC720FF6146003DC7D5 /* Assets.xcassets */, + A985FAC920FF6146003DC7D5 /* LaunchScreen.storyboard */, + A9DFBFDD20FF74D10000560F /* Info.plist */, ); path = VideoThumbnailSelectionView; sourceTree = ""; @@ -78,6 +111,23 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + A985FABD20FF6146003DC7D5 /* vidThumb */ = { + isa = PBXNativeTarget; + buildConfigurationList = A985FACD20FF6146003DC7D5 /* Build configuration list for PBXNativeTarget "vidThumb" */; + buildPhases = ( + A985FABA20FF6146003DC7D5 /* Sources */, + A985FABB20FF6146003DC7D5 /* Frameworks */, + A985FABC20FF6146003DC7D5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = vidThumb; + productName = vidThumb; + productReference = A985FABE20FF6146003DC7D5 /* vidThumb.app */; + productType = "com.apple.product-type.application"; + }; E91E33731D017AB2004EF96C /* VideoThumbnailSelectionView */ = { isa = PBXNativeTarget; buildConfigurationList = E91E337C1D017AB2004EF96C /* Build configuration list for PBXNativeTarget "VideoThumbnailSelectionView" */; @@ -102,11 +152,17 @@ E91E336B1D017AB2004EF96C /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0730; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = "Sarp Solakoğlu"; TargetAttributes = { + A985FABD20FF6146003DC7D5 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; E91E33731D017AB2004EF96C = { CreatedOnToolsVersion = 7.3.1; + ProvisioningStyle = Manual; }; }; }; @@ -116,6 +172,7 @@ hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = E91E336A1D017AB2004EF96C; productRefGroup = E91E33751D017AB2004EF96C /* Products */; @@ -123,22 +180,49 @@ projectRoot = ""; targets = ( E91E33731D017AB2004EF96C /* VideoThumbnailSelectionView */, + A985FABD20FF6146003DC7D5 /* vidThumb */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + A985FABC20FF6146003DC7D5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A985FACB20FF6146003DC7D5 /* LaunchScreen.storyboard in Resources */, + A9DFBFD820FF71380000560F /* VideoThumbnailSelectionView.xib in Resources */, + A985FAD520FF62D8003DC7D5 /* Storyboard.storyboard in Resources */, + A9DFBFDC20FF74BA0000560F /* Default-568h@2x.png in Resources */, + A985FAC820FF6146003DC7D5 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; E91E33721D017AB2004EF96C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( E91E33861D017B4F004EF96C /* VideoThumbnailSelectionView.xib in Resources */, + A985FAD420FF62D8003DC7D5 /* Storyboard.storyboard in Resources */, + A9DFBFDE20FF74D10000560F /* Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + A985FABA20FF6146003DC7D5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A9DFBFD720FF71380000560F /* VideoThumbnailSelectionView.swift in Sources */, + A9DFBFD520FF71380000560F /* ScrollOptions.swift in Sources */, + A985FAC120FF6146003DC7D5 /* AppDelegate.swift in Sources */, + A985FAD220FF61A1003DC7D5 /* HomeViewController.swift in Sources */, + A9DFBFD620FF71380000560F /* SelectionThumb.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; E91E336F1D017AB2004EF96C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -151,7 +235,65 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + A985FAC920FF6146003DC7D5 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A985FACA20FF6146003DC7D5 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ + A985FACE20FF6146003DC7D5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.indianic.vidThumb; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A985FACF20FF6146003DC7D5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.indianic.vidThumb; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; E91E337A1D017AB2004EF96C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -161,13 +303,21 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -210,13 +360,21 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -236,6 +394,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -247,7 +406,10 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_STYLE = Manual; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -257,8 +419,10 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.sarpsolakoglu.VideoThumbnailSelectionView; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -266,7 +430,10 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_STYLE = Manual; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -276,13 +443,24 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.sarpsolakoglu.VideoThumbnailSelectionView; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + A985FACD20FF6146003DC7D5 /* Build configuration list for PBXNativeTarget "vidThumb" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A985FACE20FF6146003DC7D5 /* Debug */, + A985FACF20FF6146003DC7D5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; E91E336E1D017AB2004EF96C /* Build configuration list for PBXProject "VideoThumbnailSelectionView" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -299,6 +477,7 @@ E91E337E1D017AB2004EF96C /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/VideoThumbnailSelectionView.xcodeproj/project.xcworkspace/xcuserdata/indianic.xcuserdatad/UserInterfaceState.xcuserstate b/VideoThumbnailSelectionView.xcodeproj/project.xcworkspace/xcuserdata/indianic.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..5f3da1b Binary files /dev/null and b/VideoThumbnailSelectionView.xcodeproj/project.xcworkspace/xcuserdata/indianic.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcschemes/VideoThumbnailSelectionView.xcscheme b/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcschemes/VideoThumbnailSelectionView.xcscheme new file mode 100644 index 0000000..72cac65 --- /dev/null +++ b/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcschemes/VideoThumbnailSelectionView.xcscheme @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcschemes/xcschememanagement.plist b/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..fb179d3 --- /dev/null +++ b/VideoThumbnailSelectionView.xcodeproj/xcuserdata/indianic.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + VideoThumbnailSelectionView.xcscheme + + orderHint + 0 + + vidThumb.xcscheme + + orderHint + 1 + + + SuppressBuildableAutocreation + + E91E33731D017AB2004EF96C + + primary + + + + + diff --git a/VideoThumbnailSelectionView/AppDelegate.swift b/VideoThumbnailSelectionView/AppDelegate.swift new file mode 100644 index 0000000..6e24ce0 --- /dev/null +++ b/VideoThumbnailSelectionView/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// vidThumb +// +// Created by indianic on 18/07/18. +// Copyright © 2018 Sarp Solakoğlu. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/VideoThumbnailSelectionView/Assets.xcassets/AppIcon.appiconset/Contents.json b/VideoThumbnailSelectionView/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/VideoThumbnailSelectionView/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/VideoThumbnailSelectionView/Base.lproj/LaunchScreen.storyboard b/VideoThumbnailSelectionView/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f83f6fd --- /dev/null +++ b/VideoThumbnailSelectionView/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VideoThumbnailSelectionView/HomeViewController.swift b/VideoThumbnailSelectionView/HomeViewController.swift new file mode 100644 index 0000000..aa1d074 --- /dev/null +++ b/VideoThumbnailSelectionView/HomeViewController.swift @@ -0,0 +1,62 @@ +// +// HomeViewController.swift +// VideoThumbnailSelectionView +// +// Created by indianic on 18/07/18. +// Copyright © 2018 Sarp Solakoğlu. All rights reserved. +// + +import UIKit +import AVFoundation + +class HomeViewController: UIViewController { + + var videoThumbnailSelectionView: VideoThumbnailSelectionView! + + override func viewDidLoad() { + super.viewDidLoad() + + videoThumbnailSelectionView = VideoThumbnailSelectionView(frame:CGRect.init(x: 20, y: 300, width: 325, height: 60)) + view.addSubview(videoThumbnailSelectionView) + videoThumbnailSelectionView.shadeTintAlpha = 0.5 + //scale animation when thumb is dragged (1.0 for no animation). + videoThumbnailSelectionView.zoomAnimationScale = 1.5 + //corner color + videoThumbnailSelectionView.cornerColor = .white + //corner radius + videoThumbnailSelectionView.cornerRadius = 8.0 + //corner thickness + videoThumbnailSelectionView.cornerInsets = UIEdgeInsetsMake(6.0, 6.0, 6.0, 6.0) + //called when selection changes + videoThumbnailSelectionView.onUpdatedImage = { image in + //do stuff with the image + print(image) + }; + // Do any additional setup after loading the view. + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + //after customization, call this to load your asset. + let url = URL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") + let asset: AVURLAsset = AVURLAsset(url: url!) + videoThumbnailSelectionView.loadVideo(asset: asset) + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/VideoThumbnailSelectionView/Info.plist b/VideoThumbnailSelectionView/Info.plist deleted file mode 100644 index abe61f5..0000000 --- a/VideoThumbnailSelectionView/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 0.1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/VideoThumbnailSelectionView/SelectionThumb.swift b/VideoThumbnailSelectionView/SelectionThumb.swift index 640483f..8017c62 100644 --- a/VideoThumbnailSelectionView/SelectionThumb.swift +++ b/VideoThumbnailSelectionView/SelectionThumb.swift @@ -12,9 +12,9 @@ class SelectionThumb: UIView { var previewImageView: UIImageView! override init(frame: CGRect) { - previewImageView = UIImageView(frame: CGRectMake(2, 2, frame.size.width - 4, frame.size.height - 4)) + previewImageView = UIImageView(frame: CGRect.init(x: 2, y: 2, width: frame.size.width - 2, height: frame.size.height - 4)) super.init(frame: frame) - backgroundColor = .whiteColor() + backgroundColor = .white addSubview(previewImageView) } diff --git a/VideoThumbnailSelectionView/Storyboard.storyboard b/VideoThumbnailSelectionView/Storyboard.storyboard new file mode 100644 index 0000000..a34103d --- /dev/null +++ b/VideoThumbnailSelectionView/Storyboard.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VideoThumbnailSelectionView/VideoThumbnailSelectionView.swift b/VideoThumbnailSelectionView/VideoThumbnailSelectionView.swift index 7684317..e87dbdc 100644 --- a/VideoThumbnailSelectionView/VideoThumbnailSelectionView.swift +++ b/VideoThumbnailSelectionView/VideoThumbnailSelectionView.swift @@ -75,7 +75,7 @@ import AVFoundation /** The color of the corner of the view. */ - public var cornerColor: UIColor = .whiteColor() { + public var cornerColor: UIColor = .white { didSet { view.backgroundColor = cornerColor } @@ -112,18 +112,18 @@ import AVFoundation - completion: UIImage is returned in this block if succesful. - failure: This block is called in case of failure. */ - @objc public func snapshot(forSecond second: Float64, completion:(UIImage)->(), failure:(()->())?) { + @objc public func snapshot(forSecond second: Float64, completion:@escaping (UIImage)->(), failure:(()->())?) { guard let generator = generator else { if failure != nil { failure!() } return } - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { + DispatchQueue.global(qos: .default).async() { if let image = self.generateThumbnail(generator: generator, second: second) { - dispatch_async(dispatch_get_main_queue(), { + DispatchQueue.main.async { completion(image) - }) + } return } else { if failure != nil { @@ -147,13 +147,13 @@ import AVFoundation if videoLoaded { return } if videoLoading { return } - guard let assetVideoTrack : AVAssetTrack = asset.tracksWithMediaType(AVMediaTypeVideo)[0] else { return } + let assetVideoTrack : AVAssetTrack = asset.tracks(withMediaType: AVMediaType.video)[0] self.asset = asset activityIndicator.startAnimating() - dispatch_async(dispatch_get_main_queue()) { + DispatchQueue.main.async() { let size = assetVideoTrack.naturalSize let thumbnailHeight = self.thumbnailView.bounds.size.height let videoAspect = size.width / size.height @@ -167,7 +167,7 @@ import AVFoundation let videoDuration = CMTimeGetSeconds(asset.duration) let sampleInterval = videoDuration / Float64(thumbnailCount) - self.selectionThumb = SelectionThumb(frame: CGRectMake(self.thumbnailView.frame.origin.x, self.thumbnailView.frame.origin.y, thumbnailWidth, thumbnailHeight)) + self.selectionThumb = SelectionThumb(frame: CGRect.init(x: self.thumbnailView.frame.origin.x, y: self.thumbnailView.frame.origin.y, width: thumbnailWidth, height: thumbnailHeight)) self.scrollOptions = ScrollOptions(startPoint: self.leftMargin.constant + thumbnailWidth / 2, endPoint: self.view.bounds.size.width - thumbnailWidth / 2 - self.rightMargin.constant) @@ -180,8 +180,8 @@ import AVFoundation self.selectionThumb!.previewImageView.image = image self.view.addSubview(self.selectionThumb!) } - let imageView = UIImageView(frame: CGRectMake(currentX, 0.0, thumbnailWidth, thumbnailHeight)) - imageView.contentMode = .ScaleAspectFill + let imageView = UIImageView(frame: CGRect.init(x: currentX, y: 0, width: thumbnailWidth, height: thumbnailHeight)) + imageView.contentMode = .scaleAspectFill imageView.image = image self.thumbnailView.addSubview(imageView) self.thumbnails.append(imageView) @@ -191,7 +191,7 @@ import AVFoundation self.activityIndicator.stopAnimating() self.videoLoaded = true self.videoLoading = false - self.didScrollToPercent(0, override: true) + self.didScrollToPercent(percent: 0, override: true) } } @@ -234,21 +234,21 @@ import AVFoundation }) } - private func generateThumbnail(generator generator: AVAssetImageGenerator, second: Float64) -> UIImage? { + private func generateThumbnail(generator: AVAssetImageGenerator, second: Float64) -> UIImage? { let time = CMTimeMake(Int64(second * 60), 60) do { - let imgRef = try generator.copyCGImageAtTime(time, actualTime: nil) - return UIImage(CGImage: imgRef) + let imgRef = try generator.copyCGImage(at: time, actualTime: nil) + return UIImage.init(cgImage: imgRef) } catch { return nil } } //MARK: - Private loader functions - private func setup(frame frame: CGRect?) { + private func setup(frame: CGRect?) { loadNib() if frame != nil { - view.frame = CGRectMake(0, 0, CGRectGetWidth(frame!), CGRectGetHeight(frame!)) + view.frame = CGRect.init(x: 0, y: 0, width: frame!.width, height: frame!.height) } addSubview(view) pinView() @@ -256,33 +256,33 @@ import AVFoundation } private func loadNib() { - NSBundle(forClass: VideoThumbnailSelectionView.self).loadNibNamed("VideoThumbnailSelectionView", owner: self, options: nil) + Bundle.main.loadNibNamed("VideoThumbnailSelectionView", owner: self, options: nil) } private func pinView() { view.translatesAutoresizingMaskIntoConstraints = false - NSLayoutConstraint(item: view, attribute: .Leading, relatedBy: .Equal, toItem: self , attribute: .Leading, multiplier: 1, constant: 0).active = true - NSLayoutConstraint(item: view, attribute: .Trailing, relatedBy: .Equal, toItem: self, attribute: .Trailing, multiplier: 1, constant: 0).active = true - NSLayoutConstraint(item: view, attribute: .Top, relatedBy: .Equal, toItem: self, attribute: .Top, multiplier: 1, constant: 0).active = true - NSLayoutConstraint(item: view, attribute: .Bottom, relatedBy: .Equal, toItem: self, attribute: .Bottom, multiplier: 1, constant: 0).active = true + NSLayoutConstraint(item: view, attribute: .leading, relatedBy: .equal, toItem: self , attribute: .leading, multiplier: 1, constant: 0).isActive = true + NSLayoutConstraint(item: view, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing, multiplier: 1, constant: 0).isActive = true + NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1, constant: 0).isActive = true + NSLayoutConstraint(item: view, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1, constant: 0).isActive = true setNeedsLayout() layoutIfNeeded() } //MARK: - Touches - override public func touchesBegan(touches: Set, withEvent event: UIEvent?) { + override public func touchesBegan(_ touches: Set, with event: UIEvent?) { if scrollOptions == nil { return } guard let selectionThumb = selectionThumb else { return } if let touch = touches.first { - let loc = touch.locationInView(thumbnailView) - if CGRectContainsPoint(selectionThumb.frame, loc) { + let loc = touch.location(in: thumbnailView) + if selectionThumb.frame.contains(loc) { scrollOptions!.thumbStartLocation = selectionThumb.center.x scrollOptions!.scrollStartLocation = loc.x scrollOptions!.currentlyScrolling = true if zoomAnimationScale > 1.0 { selectionThumb.layer.removeAllAnimations() - UIView.animateWithDuration(0.2, animations: { + UIView.animate(withDuration: 0.2, animations: { selectionThumb.layer.transform = CATransform3DScale(CATransform3DIdentity, self.zoomAnimationScale, self.zoomAnimationScale, 1.0) }) } @@ -291,27 +291,27 @@ import AVFoundation } - override public func touchesMoved(touches: Set, withEvent event: UIEvent?) { + override public func touchesMoved(_ touches: Set, with event: UIEvent?) { if scrollOptions == nil { return } if !(scrollOptions!.currentlyScrolling) { return } guard let selectionThumb = selectionThumb else { return } if let touch = touches.first { - let loc = touch.locationInView(thumbnailView) - let newX = scrollOptions!.getNewLocationAccordingToPoint(loc.x) + let loc = touch.location(in: thumbnailView) + let newX = scrollOptions!.getNewLocationAccordingToPoint(x: loc.x) selectionThumb.center.x = newX //call view - didScrollToPercent(scrollOptions!.scrollPercent, override: false) + didScrollToPercent(percent: scrollOptions!.scrollPercent, override: false) } } - override public func touchesEnded(touches: Set, withEvent event: UIEvent?) { + override public func touchesEnded(_ touches: Set, with event: UIEvent?) { if scrollOptions == nil { return } if !(scrollOptions!.currentlyScrolling) { return } guard let selectionThumb = selectionThumb else { return } - didScrollToPercent(scrollOptions!.scrollPercent, override: true) + didScrollToPercent(percent: scrollOptions!.scrollPercent, override: true) if zoomAnimationScale > 1.0 { selectionThumb.layer.removeAllAnimations() - UIView.animateWithDuration(0.2, animations: { + UIView.animate(withDuration: 0.2, animations: { selectionThumb.layer.transform = CATransform3DIdentity }) } diff --git a/VideoThumbnailSelectionView/VideoThumbnailSelectionView.xib b/VideoThumbnailSelectionView/VideoThumbnailSelectionView.xib index 868ef68..1495b63 100644 --- a/VideoThumbnailSelectionView/VideoThumbnailSelectionView.xib +++ b/VideoThumbnailSelectionView/VideoThumbnailSelectionView.xib @@ -1,8 +1,12 @@ - - + + + + + - + + @@ -24,17 +28,17 @@ - + - + - + diff --git a/ViewController.swift b/ViewController.swift new file mode 100644 index 0000000..36cab4a --- /dev/null +++ b/ViewController.swift @@ -0,0 +1,25 @@ +// +// ViewController.swift +// vidThumb +// +// Created by indianic on 18/07/18. +// Copyright © 2018 Sarp Solakoğlu. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + +} +