diff --git a/Examples/Swift-Example/Swift-Example/Extensions/HelperExtensions.swift b/Examples/Shared/Extensions/HelperExtensions.swift similarity index 100% rename from Examples/Swift-Example/Swift-Example/Extensions/HelperExtensions.swift rename to Examples/Shared/Extensions/HelperExtensions.swift diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Bold.otf b/Examples/Shared/Fonts/SF-UI-Text-Bold.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Bold.otf rename to Examples/Shared/Fonts/SF-UI-Text-Bold.otf diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Light.otf b/Examples/Shared/Fonts/SF-UI-Text-Light.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Light.otf rename to Examples/Shared/Fonts/SF-UI-Text-Light.otf diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-LightItalic.otf b/Examples/Shared/Fonts/SF-UI-Text-LightItalic.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-LightItalic.otf rename to Examples/Shared/Fonts/SF-UI-Text-LightItalic.otf diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Medium.otf b/Examples/Shared/Fonts/SF-UI-Text-Medium.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Medium.otf rename to Examples/Shared/Fonts/SF-UI-Text-Medium.otf diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-MediumItalic.otf b/Examples/Shared/Fonts/SF-UI-Text-MediumItalic.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-MediumItalic.otf rename to Examples/Shared/Fonts/SF-UI-Text-MediumItalic.otf diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Regular.otf b/Examples/Shared/Fonts/SF-UI-Text-Regular.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Regular.otf rename to Examples/Shared/Fonts/SF-UI-Text-Regular.otf diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-RegularItalic.otf b/Examples/Shared/Fonts/SF-UI-Text-RegularItalic.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-RegularItalic.otf rename to Examples/Shared/Fonts/SF-UI-Text-RegularItalic.otf diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Semibold.otf b/Examples/Shared/Fonts/SF-UI-Text-Semibold.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-Semibold.otf rename to Examples/Shared/Fonts/SF-UI-Text-Semibold.otf diff --git a/Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-SemiboldItalic.otf b/Examples/Shared/Fonts/SF-UI-Text-SemiboldItalic.otf similarity index 100% rename from Examples/Swift-Example/Swift-Example/Resources/Fonts/SF-UI-Text-SemiboldItalic.otf rename to Examples/Shared/Fonts/SF-UI-Text-SemiboldItalic.otf diff --git a/Examples/Shared/haptik_textLogo.imageset/Contents.json b/Examples/Shared/haptik_textLogo.imageset/Contents.json new file mode 100644 index 0000000..7c8fc35 --- /dev/null +++ b/Examples/Shared/haptik_textLogo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "haptik_textlogo.pdf", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Shared/haptik_textLogo.imageset/haptik_textlogo.pdf b/Examples/Shared/haptik_textLogo.imageset/haptik_textlogo.pdf new file mode 100644 index 0000000..ffda424 Binary files /dev/null and b/Examples/Shared/haptik_textLogo.imageset/haptik_textlogo.pdf differ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.pbxproj b/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.pbxproj new file mode 100644 index 0000000..604a3ac --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.pbxproj @@ -0,0 +1,509 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 7019E71923471BCF008EA97A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7019E71823471BCF008EA97A /* AppDelegate.swift */; }; + 7019E71B23471BCF008EA97A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7019E71A23471BCF008EA97A /* SceneDelegate.swift */; }; + 7019E71D23471BCF008EA97A /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7019E71C23471BCF008EA97A /* RootViewController.swift */; }; + 7019E72023471BD0008EA97A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7019E71E23471BD0008EA97A /* Main.storyboard */; }; + 7019E72223471BD1008EA97A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7019E72123471BD1008EA97A /* Assets.xcassets */; }; + 7019E72523471BD1008EA97A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7019E72323471BD1008EA97A /* LaunchScreen.storyboard */; }; + 7019E73D23471F53008EA97A /* HaptikLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E73A23471EA7008EA97A /* HaptikLib.framework */; }; + 7019E73E23471F53008EA97A /* HaptikLib.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E73A23471EA7008EA97A /* HaptikLib.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7019E74123471F5A008EA97A /* HaptikBase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E74023471F5A008EA97A /* HaptikBase.framework */; }; + 7019E74223471F5A008EA97A /* HaptikBase.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E74023471F5A008EA97A /* HaptikBase.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7019E74A2347205E008EA97A /* PINCache.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E7462347204D008EA97A /* PINCache.framework */; }; + 7019E74B2347205E008EA97A /* PINCache.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E7462347204D008EA97A /* PINCache.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7019E74C2347205F008EA97A /* PINOperation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E7442347204C008EA97A /* PINOperation.framework */; }; + 7019E74D2347205F008EA97A /* PINOperation.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E7442347204C008EA97A /* PINOperation.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7019E74E23472060008EA97A /* PINRemoteImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E7452347204C008EA97A /* PINRemoteImage.framework */; }; + 7019E74F23472060008EA97A /* PINRemoteImage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7019E7452347204C008EA97A /* PINRemoteImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7019E77323472378008EA97A /* SF-UI-Text-SemiboldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E76A23472378008EA97A /* SF-UI-Text-SemiboldItalic.otf */; }; + 7019E77423472378008EA97A /* SF-UI-Text-RegularItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E76B23472378008EA97A /* SF-UI-Text-RegularItalic.otf */; }; + 7019E77523472378008EA97A /* SF-UI-Text-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E76C23472378008EA97A /* SF-UI-Text-Bold.otf */; }; + 7019E77623472378008EA97A /* SF-UI-Text-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E76D23472378008EA97A /* SF-UI-Text-Regular.otf */; }; + 7019E77723472378008EA97A /* SF-UI-Text-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E76E23472378008EA97A /* SF-UI-Text-Light.otf */; }; + 7019E77823472378008EA97A /* SF-UI-Text-MediumItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E76F23472378008EA97A /* SF-UI-Text-MediumItalic.otf */; }; + 7019E77923472378008EA97A /* SF-UI-Text-LightItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E77023472378008EA97A /* SF-UI-Text-LightItalic.otf */; }; + 7019E77A23472378008EA97A /* SF-UI-Text-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E77123472378008EA97A /* SF-UI-Text-Medium.otf */; }; + 7019E77B23472378008EA97A /* SF-UI-Text-Semibold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E77223472378008EA97A /* SF-UI-Text-Semibold.otf */; }; + 7019E78123472975008EA97A /* HelperExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7019E78023472975008EA97A /* HelperExtensions.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 7019E73F23471F53008EA97A /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 7019E74F23472060008EA97A /* PINRemoteImage.framework in Embed Frameworks */, + 7019E74223471F5A008EA97A /* HaptikBase.framework in Embed Frameworks */, + 7019E73E23471F53008EA97A /* HaptikLib.framework in Embed Frameworks */, + 7019E74D2347205F008EA97A /* PINOperation.framework in Embed Frameworks */, + 7019E74B2347205E008EA97A /* PINCache.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 7019E71523471BCF008EA97A /* Swift-Example-Manual.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Swift-Example-Manual.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7019E71823471BCF008EA97A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7019E71A23471BCF008EA97A /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 7019E71C23471BCF008EA97A /* RootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = ""; }; + 7019E71F23471BD0008EA97A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 7019E72123471BD1008EA97A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 7019E72423471BD1008EA97A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 7019E72623471BD1008EA97A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7019E73A23471EA7008EA97A /* HaptikLib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HaptikLib.framework; path = ../../Frameworks/Core/HaptikLib.framework; sourceTree = ""; }; + 7019E74023471F5A008EA97A /* HaptikBase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HaptikBase.framework; path = ../../Frameworks/Base/HaptikBase.framework; sourceTree = ""; }; + 7019E7442347204C008EA97A /* PINOperation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PINOperation.framework; sourceTree = ""; }; + 7019E7452347204C008EA97A /* PINRemoteImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PINRemoteImage.framework; sourceTree = ""; }; + 7019E7462347204D008EA97A /* PINCache.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PINCache.framework; sourceTree = ""; }; + 7019E76A23472378008EA97A /* SF-UI-Text-SemiboldItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-SemiboldItalic.otf"; sourceTree = ""; }; + 7019E76B23472378008EA97A /* SF-UI-Text-RegularItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-RegularItalic.otf"; sourceTree = ""; }; + 7019E76C23472378008EA97A /* SF-UI-Text-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Bold.otf"; sourceTree = ""; }; + 7019E76D23472378008EA97A /* SF-UI-Text-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Regular.otf"; sourceTree = ""; }; + 7019E76E23472378008EA97A /* SF-UI-Text-Light.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Light.otf"; sourceTree = ""; }; + 7019E76F23472378008EA97A /* SF-UI-Text-MediumItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-MediumItalic.otf"; sourceTree = ""; }; + 7019E77023472378008EA97A /* SF-UI-Text-LightItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-LightItalic.otf"; sourceTree = ""; }; + 7019E77123472378008EA97A /* SF-UI-Text-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Medium.otf"; sourceTree = ""; }; + 7019E77223472378008EA97A /* SF-UI-Text-Semibold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Semibold.otf"; sourceTree = ""; }; + 7019E78023472975008EA97A /* HelperExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelperExtensions.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 7019E71223471BCF008EA97A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7019E74E23472060008EA97A /* PINRemoteImage.framework in Frameworks */, + 7019E74C2347205F008EA97A /* PINOperation.framework in Frameworks */, + 7019E74A2347205E008EA97A /* PINCache.framework in Frameworks */, + 7019E74123471F5A008EA97A /* HaptikBase.framework in Frameworks */, + 7019E73D23471F53008EA97A /* HaptikLib.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 7019E70C23471BCF008EA97A = { + isa = PBXGroup; + children = ( + 7019E71723471BCF008EA97A /* Swift-Example-Manual */, + 7019E71623471BCF008EA97A /* Products */, + 7019E73923471EA7008EA97A /* Frameworks */, + ); + sourceTree = ""; + }; + 7019E71623471BCF008EA97A /* Products */ = { + isa = PBXGroup; + children = ( + 7019E71523471BCF008EA97A /* Swift-Example-Manual.app */, + ); + name = Products; + sourceTree = ""; + }; + 7019E71723471BCF008EA97A /* Swift-Example-Manual */ = { + isa = PBXGroup; + children = ( + 7019E77F23472975008EA97A /* Extensions */, + 7019E71823471BCF008EA97A /* AppDelegate.swift */, + 7019E71A23471BCF008EA97A /* SceneDelegate.swift */, + 7019E72C23471C4C008EA97A /* Controllers */, + 7019E74323472025008EA97A /* Dependencies */, + 7019E72D23471D4A008EA97A /* Resources */, + 7019E72F23471D5B008EA97A /* Storyboards */, + 7019E73023471D61008EA97A /* Supporting Files */, + ); + path = "Swift-Example-Manual"; + sourceTree = ""; + }; + 7019E72C23471C4C008EA97A /* Controllers */ = { + isa = PBXGroup; + children = ( + 7019E71C23471BCF008EA97A /* RootViewController.swift */, + ); + path = Controllers; + sourceTree = ""; + }; + 7019E72D23471D4A008EA97A /* Resources */ = { + isa = PBXGroup; + children = ( + 7019E76923472378008EA97A /* Fonts */, + 7019E72123471BD1008EA97A /* Assets.xcassets */, + ); + path = Resources; + sourceTree = ""; + }; + 7019E72F23471D5B008EA97A /* Storyboards */ = { + isa = PBXGroup; + children = ( + 7019E71E23471BD0008EA97A /* Main.storyboard */, + ); + path = Storyboards; + sourceTree = ""; + }; + 7019E73023471D61008EA97A /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 7019E72323471BD1008EA97A /* LaunchScreen.storyboard */, + 7019E72623471BD1008EA97A /* Info.plist */, + ); + path = "Supporting Files"; + sourceTree = ""; + }; + 7019E73923471EA7008EA97A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 7019E74023471F5A008EA97A /* HaptikBase.framework */, + 7019E73A23471EA7008EA97A /* HaptikLib.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7019E74323472025008EA97A /* Dependencies */ = { + isa = PBXGroup; + children = ( + 7019E7462347204D008EA97A /* PINCache.framework */, + 7019E7442347204C008EA97A /* PINOperation.framework */, + 7019E7452347204C008EA97A /* PINRemoteImage.framework */, + ); + path = Dependencies; + sourceTree = ""; + }; + 7019E76923472378008EA97A /* Fonts */ = { + isa = PBXGroup; + children = ( + 7019E76A23472378008EA97A /* SF-UI-Text-SemiboldItalic.otf */, + 7019E76B23472378008EA97A /* SF-UI-Text-RegularItalic.otf */, + 7019E76C23472378008EA97A /* SF-UI-Text-Bold.otf */, + 7019E76D23472378008EA97A /* SF-UI-Text-Regular.otf */, + 7019E76E23472378008EA97A /* SF-UI-Text-Light.otf */, + 7019E76F23472378008EA97A /* SF-UI-Text-MediumItalic.otf */, + 7019E77023472378008EA97A /* SF-UI-Text-LightItalic.otf */, + 7019E77123472378008EA97A /* SF-UI-Text-Medium.otf */, + 7019E77223472378008EA97A /* SF-UI-Text-Semibold.otf */, + ); + name = Fonts; + path = ../../../Shared/Fonts; + sourceTree = ""; + }; + 7019E77F23472975008EA97A /* Extensions */ = { + isa = PBXGroup; + children = ( + 7019E78023472975008EA97A /* HelperExtensions.swift */, + ); + name = Extensions; + path = ../../Shared/Extensions; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7019E71423471BCF008EA97A /* Swift-Example-Manual */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7019E72923471BD1008EA97A /* Build configuration list for PBXNativeTarget "Swift-Example-Manual" */; + buildPhases = ( + 7019E71123471BCF008EA97A /* Sources */, + 7019E71223471BCF008EA97A /* Frameworks */, + 7019E71323471BCF008EA97A /* Resources */, + 7019E73F23471F53008EA97A /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Swift-Example-Manual"; + productName = "Swift-Example-Manual"; + productReference = 7019E71523471BCF008EA97A /* Swift-Example-Manual.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7019E70D23471BCF008EA97A /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1100; + LastUpgradeCheck = 1100; + ORGANIZATIONNAME = Haptik; + TargetAttributes = { + 7019E71423471BCF008EA97A = { + CreatedOnToolsVersion = 11.0; + }; + }; + }; + buildConfigurationList = 7019E71023471BCF008EA97A /* Build configuration list for PBXProject "Swift-Example-Manual" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7019E70C23471BCF008EA97A; + productRefGroup = 7019E71623471BCF008EA97A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7019E71423471BCF008EA97A /* Swift-Example-Manual */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7019E71323471BCF008EA97A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7019E77B23472378008EA97A /* SF-UI-Text-Semibold.otf in Resources */, + 7019E77523472378008EA97A /* SF-UI-Text-Bold.otf in Resources */, + 7019E77323472378008EA97A /* SF-UI-Text-SemiboldItalic.otf in Resources */, + 7019E77923472378008EA97A /* SF-UI-Text-LightItalic.otf in Resources */, + 7019E72523471BD1008EA97A /* LaunchScreen.storyboard in Resources */, + 7019E77423472378008EA97A /* SF-UI-Text-RegularItalic.otf in Resources */, + 7019E77823472378008EA97A /* SF-UI-Text-MediumItalic.otf in Resources */, + 7019E72223471BD1008EA97A /* Assets.xcassets in Resources */, + 7019E77623472378008EA97A /* SF-UI-Text-Regular.otf in Resources */, + 7019E77723472378008EA97A /* SF-UI-Text-Light.otf in Resources */, + 7019E72023471BD0008EA97A /* Main.storyboard in Resources */, + 7019E77A23472378008EA97A /* SF-UI-Text-Medium.otf in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7019E71123471BCF008EA97A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7019E71D23471BCF008EA97A /* RootViewController.swift in Sources */, + 7019E78123472975008EA97A /* HelperExtensions.swift in Sources */, + 7019E71923471BCF008EA97A /* AppDelegate.swift in Sources */, + 7019E71B23471BCF008EA97A /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 7019E71E23471BD0008EA97A /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 7019E71F23471BD0008EA97A /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 7019E72323471BD1008EA97A /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 7019E72423471BD1008EA97A /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 7019E72723471BD1008EA97A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = 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_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7019E72823471BD1008EA97A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = 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_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7019E72A23471BD1008EA97A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = Q2Q75CJV2G; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Swift-Example-Manual/Dependencies", + "$(PROJECT_DIR)/../../Frameworks/**", + ); + INFOPLIST_FILE = "$(SRCROOT)/Swift-Example-Manual/Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.haptik.Swift-Example-Manual"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + 7019E72B23471BD1008EA97A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = Q2Q75CJV2G; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Swift-Example-Manual/Dependencies", + "$(PROJECT_DIR)/../../Frameworks/**", + ); + INFOPLIST_FILE = "$(SRCROOT)/Swift-Example-Manual/Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.haptik.Swift-Example-Manual"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7019E71023471BCF008EA97A /* Build configuration list for PBXProject "Swift-Example-Manual" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7019E72723471BD1008EA97A /* Debug */, + 7019E72823471BD1008EA97A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7019E72923471BD1008EA97A /* Build configuration list for PBXNativeTarget "Swift-Example-Manual" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7019E72A23471BD1008EA97A /* Debug */, + 7019E72B23471BD1008EA97A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7019E70D23471BCF008EA97A /* Project object */; +} diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..630220c --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/AppDelegate.swift b/Examples/Swift-Example-Manual/Swift-Example-Manual/AppDelegate.swift new file mode 100644 index 0000000..3206276 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/AppDelegate.swift @@ -0,0 +1,132 @@ +// +// AppDelegate.swift +// Swift-Example-Manual +// +// Created by SimranJot Singh on 04/10/19. +// Copyright © 2019 Haptik. All rights reserved. +// + +import UIKit +import HaptikLib +import HaptikBase + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + + // Required at the Initial Launch of the Application + Haptik.sharedSDK().notify(application, launchedWithOptions: launchOptions) + + // Required for Enterprise Clients + HPConfiguration.shared().useInbox = false; + + // + + + // If you need the callbacks of the analytics data that haptik sends + HPConfiguration.shared().analyticsCallbackObject = self; + + // Setup UI Theme for Haptik + setHaptikTheme() + + // Interactive Pop Gesture + + // This BOOL controls the functionality of the EdgePanGestureRecognizer feature of UINavigationController + // that allows to set the slide to go back functionality for Haptik Screens. By default the value will be true. + + HPConfiguration.shared().useInteractivePopGesture = true + + return true + } + + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { + + // Let Haptik handle the redirect if required + + let isHandledByHaptik = Haptik.sharedSDK().isRedirectHandled(url, options: options) + return isHandledByHaptik + } + + func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { + + // You need to pass the Device Token after the user successfully signs up in Haptik. Till that you need to store it in your application. + + UserDefaults.standard.set(deviceToken, forKey: "kDeviceToken") + UserDefaults.standard.synchronize() + } + + func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { + + // Check if the notification received belongs to haptik and take action accordingly + + let isHaptikNotification = Haptik.sharedSDK().canHandleNotification(userInfo: userInfo as! [String : Any]) + + if isHaptikNotification { + + print("Do Housekeeping") + handleNotificationInteraction(userInfo as! [String : Any]) + } + } +} + +//MARK: Helper Methods + +extension AppDelegate { + + func handleNotificationInteraction(_ userInfo: [String: Any]) { + + if let rootVC = self.window?.rootViewController { + if let controller = rootVC as? UINavigationController { + + // You need to pass an instance of a viewController from which the user will be taken to the conversationViewController (where the user will be conversing) + // on the tap of the Notificationm + Haptik.sharedSDK().didReceiveRemoteNotification(userInfo, controller: controller.visibleViewController!) + + } + } + } + + func setHaptikTheme() { + + // NOTE: Haptik only gives instances of viewControllers. When you push them on your stack, the navigationBar is still the yours, hence it's appearance too. + + // The following there configuration is the default configuration. If you don't provide one then the SDK will try to adopt the following. + + HPConfiguration.shared().themeConfig = HPThemeService.build { (builder) in + + builder?.brandColor = UIColor(hexString: "#2196f3") + builder?.businessChatBackground = UIColor(hexString: "#f0f0f0") + builder?.businessChatText = UIColor(hexString: "#333333") + builder?.messageTimeStamp = UIColor(hexString: "#777777") + + // Providing Fonts are Madatory else the SDK will Assert + + builder?.lightFont = "SFUIText-Light" + builder?.regularFont = "SFUIText-Regular" + builder?.mediumFont = "SFUIText-Medium" + builder?.boldFont = "SFUIText-Bold" + builder?.semiBoldFont = "SFUIText-Semibold" + builder?.italicFont = "SFUIText-Italic" + } + } +} + + +// MARK: - HPAnalytics Service Delegates + +extension AppDelegate: HPAnalyticsServiceDelegate { + + func eventTracked(_ eventName: String, forParams params: [AnyHashable : Any]?) { + + // Get all the events tracked here + } + + func errorTracked(_ errorMessage: String, forError error: Error?) { + + // Get all the errors tracked here + } +} + diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Controllers/RootViewController.swift b/Examples/Swift-Example-Manual/Swift-Example-Manual/Controllers/RootViewController.swift new file mode 100644 index 0000000..6abe5cb --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Controllers/RootViewController.swift @@ -0,0 +1,76 @@ +// +// RootViewController.swift +// Swift-Example-Manual +// +// Created by SimranJot Singh on 04/10/19. +// Copyright © 2019 Haptik. All rights reserved. +// + +import UIKit +import HaptikLib + +class RootViewController: UIViewController { + + // MARK: Outlets & Attributes + + @IBOutlet weak var signupBtn: UIButton! + @IBOutlet weak var loadingIndicator: UIActivityIndicatorView! + + + // MARK: Controller Lifecycle + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + + // MARK: Actions + + @IBAction func signupTapped(_ sender: UIButton) { + + if Haptik.sharedSDK().isUserSignedUp() { + + // NOTE: For Publishers: + // initialVC gives a list of channels that are available to that client + + // Haptik.sharedSDK().getInitialVC() gives you the initialVC that you can push on your stack + + // NOTE: For Enterprise: + // You don't need to push to the initialVC that Haptik gives. You need to directly go to the conversation channel with the "viaName" that will be provided to you. + // You can use: + + /*Haptik.sharedSDK().launchChannel(with: "provided_via_name", + message: "any_message_you_wanna_start_With", + controller: <#instance_of_vc_from_which_the_conversationVC_is_pushed#>)*/ + } + else { + + loadingIndicator.startAnimating() + signupBtn.isHidden = loadingIndicator.isAnimating + + let signupObject = HPSignUpObject.build(withAuthType: "basic") { (builder) in + + builder.userFullName = "Simranjot" + + // You can set more properties on the builder according to the requirements + } + + Haptik.sharedSDK().signUp(with: signupObject) { [unowned self] (success, initialVC, error) in + + if success { + + // From here you can either push to the specific conversation controller or to the list of channel controller according to your requirements + } + else { + + // Handle Error here + } + + self.loadingIndicator.stopAnimating() + self.signupBtn.isHidden = self.loadingIndicator.isAnimating + } + } + } +} + diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCache.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCache.h new file mode 100644 index 0000000..fa743a8 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCache.h @@ -0,0 +1,141 @@ +// PINCache is a modified version of TMCache +// Modifications by Garrett Moon +// Copyright (c) 2015 Pinterest. All rights reserved. + +#import + +#import +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PINCache; + + +/** + `PINCache` is a thread safe key/value store designed for persisting temporary objects that are expensive to + reproduce, such as downloaded data or the results of slow processing. It is comprised of two self-similar + stores, one in memory () and one on disk (). + + `PINCache` itself actually does very little; its main function is providing a front end for a common use case: + a small, fast memory cache that asynchronously persists itself to a large, slow disk cache. When objects are + removed from the memory cache in response to an "apocalyptic" event they remain in the disk cache and are + repopulated in memory the next time they are accessed. `PINCache` also does the tedious work of creating a + dispatch group to wait for both caches to finish their operations without blocking each other. + + The parallel caches are accessible as public properties ( and ) and can be manipulated + separately if necessary. See the docs for and for more details. + + @warning when using in extension or watch extension, define PIN_APP_EXTENSIONS=1 + */ + +PIN_SUBCLASSING_RESTRICTED +@interface PINCache : NSObject + +#pragma mark - +/// @name Core + +/** + Synchronously retrieves the total byte count of the on the shared disk queue. + */ +@property (readonly) NSUInteger diskByteCount; + +/** + The underlying disk cache, see for additional configuration and trimming options. + */ +@property (readonly) PINDiskCache *diskCache; + +/** + The underlying memory cache, see for additional configuration and trimming options. + */ +@property (readonly) PINMemoryCache *memoryCache; + +#pragma mark - Lifecycle +/// @name Initialization + +/** + A shared cache. + + @result The shared singleton cache instance. + */ +@property (class, strong, readonly) PINCache *sharedCache; + +- (instancetype)init NS_UNAVAILABLE; + +/** + Multiple instances with the same name are *not* allowed and can *not* safely + access the same data on disk. Also used to create the . + + @see name + @param name The name of the cache. + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(nonnull NSString *)name; + +/** + Multiple instances with the same name are *not* allowed and can *not* safely + access the same data on disk. Also used to create the . + + @see name + @param name The name of the cache. + @param rootPath The path of the cache on disk. + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath; + +/** + Multiple instances with the same name are *not* allowed and can *not* safely + access the same data on disk.. Also used to create the . + Initializer allows you to override default NSKeyedArchiver/NSKeyedUnarchiver serialization for . + You must provide both serializer and deserializer, or opt-out to default implementation providing nil values. + + @see name + @param name The name of the cache. + @param rootPath The path of the cache on disk. + @param serializer A block used to serialize object before writing to disk. If nil provided, default NSKeyedArchiver serialized will be used. + @param deserializer A block used to deserialize object read from disk. If nil provided, default NSKeyedUnarchiver serialized will be used. + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(NSString *)name + rootPath:(NSString *)rootPath + serializer:(nullable PINDiskCacheSerializerBlock)serializer + deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer; + + +/** + Multiple instances with the same name are *not* allowed and can *not* safely + access the same data on disk. Also used to create the . + Initializer allows you to override default NSKeyedArchiver/NSKeyedUnarchiver serialization for . + You must provide both serializer and deserializer, or opt-out to default implementation providing nil values. + + @see name + @param name The name of the cache. + @param rootPath The path of the cache on disk. + @param serializer A block used to serialize object before writing to disk. If nil provided, default NSKeyedArchiver serialized will be used. + @param deserializer A block used to deserialize object read from disk. If nil provided, default NSKeyedUnarchiver serialized will be used. + @param keyEncoder A block used to encode key(filename). If nil provided, default url encoder will be used + @param keyDecoder A block used to decode key(filename). If nil provided, default url decoder will be used + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(nonnull NSString *)name + rootPath:(nonnull NSString *)rootPath + serializer:(nullable PINDiskCacheSerializerBlock)serializer + deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer + keyEncoder:(nullable PINDiskCacheKeyEncoderBlock)keyEncoder + keyDecoder:(nullable PINDiskCacheKeyDecoderBlock)keyDecoder NS_DESIGNATED_INITIALIZER; + +@end + +@interface PINCache (Deprecated) +- (void)containsObjectForKey:(NSString *)key block:(PINCacheObjectContainmentBlock)block __attribute__((deprecated)); +- (void)objectForKey:(NSString *)key block:(PINCacheObjectBlock)block __attribute__((deprecated)); +- (void)setObject:(id )object forKey:(NSString *)key block:(nullable PINCacheObjectBlock)block __attribute__((deprecated)); +- (void)setObject:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost block:(nullable PINCacheObjectBlock)block __attribute__((deprecated)); +- (void)removeObjectForKey:(NSString *)key block:(nullable PINCacheObjectBlock)block __attribute__((deprecated)); +- (void)trimToDate:(NSDate *)date block:(nullable PINCacheBlock)block __attribute__((deprecated)); +- (void)removeAllObjects:(nullable PINCacheBlock)block __attribute__((deprecated)); +@end + +NS_ASSUME_NONNULL_END diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCacheMacros.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCacheMacros.h new file mode 100644 index 0000000..e7179a1 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCacheMacros.h @@ -0,0 +1,23 @@ +// +// PINCacheMacros.h +// PINCache +// +// Created by Adlai Holler on 1/31/17. +// Copyright © 2017 Pinterest. All rights reserved. +// + +#ifndef PIN_SUBCLASSING_RESTRICTED +#if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) +#define PIN_SUBCLASSING_RESTRICTED __attribute__((objc_subclassing_restricted)) +#else +#define PIN_SUBCLASSING_RESTRICTED +#endif // #if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) +#endif // #ifndef PIN_SUBCLASSING_RESTRICTED + +#ifndef PIN_NOESCAPE +#if defined(__has_attribute) && __has_attribute(noescape) +#define PIN_NOESCAPE __attribute__((noescape)) +#else +#define PIN_NOESCAPE +#endif // #if defined(__has_attribute) && __has_attribute(noescape) +#endif // #ifndef PIN_NOESCAPE diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCacheObjectSubscripting.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCacheObjectSubscripting.h new file mode 100644 index 0000000..a7bd20b --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCacheObjectSubscripting.h @@ -0,0 +1,35 @@ +// +// PINCacheObjectSubscripting.h +// PINCache +// +// Created by Rocir Marcos Leite Santiago on 4/2/16. +// Copyright © 2016 Pinterest. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol PINCacheObjectSubscripting + +@required + +/** + This method enables using literals on the receiving object, such as `id object = cache[@"key"];`. + + @param key The key associated with the object. + @result The object for the specified key. + */ +- (nullable id)objectForKeyedSubscript:(NSString *)key; + +/** + This method enables using literals on the receiving object, such as `cache[@"key"] = object;`. + + @param object An object to be assigned for the key. Pass `nil` to remove the existing object for this key. + @param key A key to associate with the object. This string will be copied. + */ +- (void)setObject:(nullable id)object forKeyedSubscript:(NSString *)key; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCaching.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCaching.h new file mode 100644 index 0000000..6b94136 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINCaching.h @@ -0,0 +1,195 @@ +// +// PINCaching.h +// PINCache +// +// Created by Michael Schneider on 1/31/17. +// Copyright © 2017 Pinterest. All rights reserved. +// + +#pragma once +#import + + +NS_ASSUME_NONNULL_BEGIN + +@protocol PINCaching; + +/** + A callback block which provides only the cache as an argument + */ +typedef void (^PINCacheBlock)(id cache); + +/** + A callback block which provides the cache, key and object as arguments + */ +typedef void (^PINCacheObjectBlock)(id cache, NSString *key, id _Nullable object); + +/** + A callback block used for enumeration which provides the cache, key and object as arguments plus a stop flag that + may be flipped by the caller. + */ +typedef void (^PINCacheObjectEnumerationBlock)(id cache, NSString *key, id _Nullable object, BOOL *stop); + +/** + A callback block which provides a BOOL value as argument + */ +typedef void (^PINCacheObjectContainmentBlock)(BOOL containsObject); + +@protocol PINCaching + +#pragma mark - Core + +/** + The name of this cache, used to create a directory under Library/Caches and also appearing in stack traces. + */ +@property (readonly) NSString *name; + +#pragma mark - Asynchronous Methods + +/// @name Asynchronous Methods + +/** + This method determines whether an object is present for the given key in the cache. This method returns immediately + and executes the passed block after the object is available, potentially in parallel with other blocks on the + . + + @see containsObjectForKey: + @param key The key associated with the object. + @param block A block to be executed concurrently after the containment check happened + */ +- (void)containsObjectForKeyAsync:(NSString *)key completion:(PINCacheObjectContainmentBlock)block; + +/** + Retrieves the object for the specified key. This method returns immediately and executes the passed + block after the object is available, potentially in parallel with other blocks on the . + + @param key The key associated with the requested object. + @param block A block to be executed concurrently when the object is available. + */ +- (void)objectForKeyAsync:(NSString *)key completion:(PINCacheObjectBlock)block; + +/** + Stores an object in the cache for the specified key. This method returns immediately and executes the + passed block after the object has been stored, potentially in parallel with other blocks on the . + + @param object An object to store in the cache. + @param key A key to associate with the object. This string will be copied. + @param block A block to be executed concurrently after the object has been stored, or nil. + */ +- (void)setObjectAsync:(id)object forKey:(NSString *)key completion:(nullable PINCacheObjectBlock)block; + +/** + Stores an object in the cache for the specified key and the specified memory cost. If the cost causes the total + to go over the the cache is trimmed (oldest objects first). This method returns immediately + and executes the passed block after the object has been stored, potentially in parallel with other blocks + on the . + + @param object An object to store in the cache. + @param key A key to associate with the object. This string will be copied. + @param cost An amount to add to the . + @param block A block to be executed concurrently after the object has been stored, or nil. + */ +- (void)setObjectAsync:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost completion:(nullable PINCacheObjectBlock)block; + +/** + Removes the object for the specified key. This method returns immediately and executes the passed + block after the object has been removed, potentially in parallel with other blocks on the . + + @param key The key associated with the object to be removed. + @param block A block to be executed concurrently after the object has been removed, or nil. + */ +- (void)removeObjectForKeyAsync:(NSString *)key completion:(nullable PINCacheObjectBlock)block; + +/** + Removes all objects from the cache that have not been used since the specified date. This method returns immediately and + executes the passed block after the cache has been trimmed, potentially in parallel with other blocks on the . + + @param date Objects that haven't been accessed since this date are removed from the cache. + @param block A block to be executed concurrently after the cache has been trimmed, or nil. + */ +- (void)trimToDateAsync:(NSDate *)date completion:(nullable PINCacheBlock)block; + +/** + Removes all objects from the cache.This method returns immediately and executes the passed block after the + cache has been cleared, potentially in parallel with other blocks on the . + + @param block A block to be executed concurrently after the cache has been cleared, or nil. + */ +- (void)removeAllObjectsAsync:(nullable PINCacheBlock)block; + + +#pragma mark - Synchronous Methods +/// @name Synchronous Methods + +/** + This method determines whether an object is present for the given key in the cache. + + @see containsObjectForKeyAsync:completion: + @param key The key associated with the object. + @result YES if an object is present for the given key in the cache, otherwise NO. + */ +- (BOOL)containsObjectForKey:(NSString *)key; + +/** + Retrieves the object for the specified key. This method blocks the calling thread until the object is available. + Uses a lock to achieve synchronicity on the disk cache. + + @see objectForKeyAsync:completion: + @param key The key associated with the object. + @result The object for the specified key. + */ +- (nullable id)objectForKey:(NSString *)key; + +/** + Stores an object in the cache for the specified key. This method blocks the calling thread until the object has been set. + Uses a lock to achieve synchronicity on the disk cache. + + @see setObjectAsync:forKey:completion: + @param object An object to store in the cache. + @param key A key to associate with the object. This string will be copied. + */ +- (void)setObject:(nullable id)object forKey:(NSString *)key; + +/** + Stores an object in the cache for the specified key and the specified memory cost. If the cost causes the total + to go over the the cache is trimmed (oldest objects first). This method blocks the calling thread + until the object has been stored. + + @param object An object to store in the cache. + @param key A key to associate with the object. This string will be copied. + @param cost An amount to add to the . + */ +- (void)setObject:(nullable id)object forKey:(NSString *)key withCost:(NSUInteger)cost; + +/** + Removes the object for the specified key. This method blocks the calling thread until the object + has been removed. + Uses a lock to achieve synchronicity on the disk cache. + + @see removeObjectForKeyAsync:completion: + @param key The key associated with the object to be removed. + */ +- (void)removeObjectForKey:(NSString *)key; + +/** + Removes all objects from the cache that have not been used since the specified date. + This method blocks the calling thread until the cache has been trimmed. + Uses a lock to achieve synchronicity on the disk cache. + + @see trimToDateAsync:completion: + @param date Objects that haven't been accessed since this date are removed from the cache. + */ +- (void)trimToDate:(NSDate *)date; + +/** + Removes all objects from the cache. This method blocks the calling thread until the cache has been cleared. + Uses a lock to achieve synchronicity on the disk cache. + + @see removeAllObjectsAsync: + */ +- (void)removeAllObjects; + +@end + +NS_ASSUME_NONNULL_END + diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINDiskCache.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINDiskCache.h new file mode 100644 index 0000000..24e1d1b --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINDiskCache.h @@ -0,0 +1,515 @@ +// PINCache is a modified version of TMCache +// Modifications by Garrett Moon +// Copyright (c) 2015 Pinterest. All rights reserved. + +#import + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PINDiskCache; +@class PINOperationQueue; + +extern NSString * const PINDiskCachePrefix; + +/** + A callback block which provides the cache, key and object as arguments + */ +typedef void (^PINDiskCacheObjectBlock)(PINDiskCache *cache, NSString *key, id _Nullable object); + +/** + A callback block which provides the key and fileURL of the object + */ +typedef void (^PINDiskCacheFileURLBlock)(NSString *key, NSURL * _Nullable fileURL); + +/** + A callback block used for enumeration which provides the key and fileURL of the object plus a stop flag that + may be flipped by the caller. + */ +typedef void (^PINDiskCacheFileURLEnumerationBlock)(NSString *key, NSURL * _Nullable fileURL, BOOL *stop); + +/** + A callback block which provides a BOOL value as argument + */ +typedef void (^PINDiskCacheContainsBlock)(BOOL containsObject); + +/** + * A block used to serialize object before writing to disk + * + * @param object Object to serialize + * @param key The key associated with the object + * + * @return Serialized object representation + */ +typedef NSData* _Nonnull(^PINDiskCacheSerializerBlock)(id object, NSString *key); + +/** + * A block used to deserialize objects + * + * @param data Serialized object data + * @param key The key associated with the object + * + * @return Deserialized object + */ +typedef id _Nonnull(^PINDiskCacheDeserializerBlock)(NSData* data, NSString *key); + +/** + * A block used to encode keys + * + * @param decodedKey Original/decoded key + * + * @return encoded key + */ +typedef NSString *_Nonnull(^PINDiskCacheKeyEncoderBlock)(NSString *decodedKey); + +/** + * A block used to decode keys + * + * @param encodedKey An encoded key + * + * @return decoded key + */ +typedef NSString *_Nonnull(^PINDiskCacheKeyDecoderBlock)(NSString *encodedKey); + + +/** + `PINDiskCache` is a thread safe key/value store backed by the file system. It accepts any object conforming + to the `NSCoding` protocol, which includes the basic Foundation data types and collection classes and also + many UIKit classes, notably `UIImage`. All work is performed on a serial queue shared by all instances in + the app, and archiving is handled by `NSKeyedArchiver`. This is a particular advantage for `UIImage` because + it skips `UIImagePNGRepresentation()` and retains information like scale and orientation. + + The designated initializer for `PINDiskCache` is . The string is used to create a directory + under Library/Caches that scopes disk access for this instance. Multiple instances with the same name are *not* + allowed as they would conflict with each other. + + Unless otherwise noted, all properties and methods are safe to access from any thread at any time. All blocks + will cause the queue to wait, making it safe to access and manipulate the actual cache files on disk for the + duration of the block. + + Because this cache is bound by disk I/O it can be much slower than , although values stored in + `PINDiskCache` persist after application relaunch. Using is recommended over using `PINDiskCache` + by itself, as it adds a fast layer of additional memory caching while still writing to disk. + + All access to the cache is dated so the that the least-used objects can be trimmed first. Setting an optional + will trigger a GCD timer to periodically to trim the cache with . + */ + +PIN_SUBCLASSING_RESTRICTED +@interface PINDiskCache : NSObject + +#pragma mark - Class + +/** + @param rootPath The path for where the cache should be stored. + @param prefix The prefix for the cache name. + @param name The name of the cache. + @result The full URL of the cache. + */ ++ (NSURL *)cacheURLWithRootPath:(NSString *)rootPath prefix:(NSString *)prefix name:(NSString *)name; + +#pragma mark - Properties +/// @name Core + +/** + The prefix to the name of this cache, used to create a directory under Library/Caches and also appearing in stack traces. + */ +@property (readonly) NSString *prefix; + +/** + The URL of the directory used by this cache, usually `Library/Caches/com.pinterest.PINDiskCache.(name)` + + @warning Do not interact with files under this URL except in or + . + */ +@property (readonly) NSURL *cacheURL; + +/** + The total number of bytes used on disk, as reported by `NSURLTotalFileAllocatedSizeKey`. + + @warning This property should only be read from a call to or + its asynchronous equivalent + + For example: + + // some background thread + + __block NSUInteger byteCount = 0; + + [_diskCache synchronouslyLockFileAccessWhileExecutingBlock:^(PINDiskCache *diskCache) { + byteCount = diskCache.byteCount; + }]; + */ +@property (readonly) NSUInteger byteCount; + +/** + The maximum number of bytes allowed on disk. This value is checked every time an object is set, if the written + size exceeds the limit a trim call is queued. Defaults to `0.0`, meaning no practical limit. + + */ +@property (assign) NSUInteger byteLimit; + +/** + The maximum number of seconds an object is allowed to exist in the cache. Setting this to a value + greater than `0.0` will start a recurring GCD timer with the same period that calls . + Setting it back to `0.0` will stop the timer. Defaults to `0.0`, meaning no limit. + + */ +@property (assign) NSTimeInterval ageLimit; + +/** + The writing protection option used when writing a file on disk. This value is used every time an object is set. + NSDataWritingAtomic and NSDataWritingWithoutOverwriting are ignored if set + Defaults to NSDataWritingFileProtectionNone. + + @warning Only new files are affected by the new writing protection. If you need all files to be affected, + you'll have to purge and set the objects back to the cache + + Only available on iOS + */ +#if TARGET_OS_IPHONE +@property (assign) NSDataWritingOptions writingProtectionOption; +#endif + +/** + If ttlCache is YES, the cache behaves like a ttlCache. This means that once an object enters the + cache, it only lives as long as self.ageLimit. This has the following implications: + - Accessing an object in the cache does not extend that object's lifetime in the cache + - When attempting to access an object in the cache that has lived longer than self.ageLimit, + the cache will behave as if the object does not exist + + */ +@property (nonatomic, assign, getter=isTTLCache) BOOL ttlCache; + +#pragma mark - Event Blocks +/// @name Event Blocks + +/** + A block to be executed just before an object is added to the cache. The queue waits during execution. + */ +@property (nullable, copy) PINDiskCacheObjectBlock willAddObjectBlock; + +/** + A block to be executed just before an object is removed from the cache. The queue waits during execution. + */ +@property (nullable, copy) PINDiskCacheObjectBlock willRemoveObjectBlock; + +/** + A block to be executed just before all objects are removed from the cache as a result of . + The queue waits during execution. + */ +@property (nullable, copy) PINCacheBlock willRemoveAllObjectsBlock; + +/** + A block to be executed just after an object is added to the cache. The queue waits during execution. + */ +@property (nullable, copy) PINDiskCacheObjectBlock didAddObjectBlock; + +/** + A block to be executed just after an object is removed from the cache. The queue waits during execution. + */ +@property (nullable, copy) PINDiskCacheObjectBlock didRemoveObjectBlock; + +/** + A block to be executed just after all objects are removed from the cache as a result of . + The queue waits during execution. + */ +@property (nullable, copy) PINCacheBlock didRemoveAllObjectsBlock; + +#pragma mark - Lifecycle +/// @name Initialization + +/** + A shared cache. + + @result The shared singleton cache instance. + */ +@property (class, readonly, strong) PINDiskCache *sharedCache; + +/** + Empties the trash with `DISPATCH_QUEUE_PRIORITY_BACKGROUND`. Does not use lock. + */ ++ (void)emptyTrash; + +- (instancetype)init NS_UNAVAILABLE; + +/** + Multiple instances with the same name are allowed and can safely access + the same data on disk thanks to the magic of seriality. + + @see name + @param name The name of the cache. + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(nonnull NSString *)name; + +/** + Multiple instances with the same name are allowed and can safely access + the same data on disk thanks to the magic of seriality. + + @see name + @param name The name of the cache. + @param rootPath The path of the cache. + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath; + +/** + @see name + @param name The name of the cache. + @param rootPath The path of the cache. + @param serializer A block used to serialize object. If nil provided, default NSKeyedArchiver serialized will be used. + @param deserializer A block used to deserialize object. If nil provided, default NSKeyedUnarchiver serialized will be used. + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath serializer:(nullable PINDiskCacheSerializerBlock)serializer deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer; + +/** + The designated initializer allowing you to override default NSKeyedArchiver/NSKeyedUnarchiver serialization. + + @see name + @param name The name of the cache. + @param rootPath The path of the cache. + @param serializer A block used to serialize object. If nil provided, default NSKeyedArchiver serialized will be used. + @param deserializer A block used to deserialize object. If nil provided, default NSKeyedUnarchiver serialized will be used. + @param operationQueue A PINOperationQueue to run asynchronous operations + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath serializer:(nullable PINDiskCacheSerializerBlock)serializer deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer operationQueue:(nonnull PINOperationQueue *)operationQueue __attribute__((deprecated)); + +/** + The designated initializer allowing you to override default NSKeyedArchiver/NSKeyedUnarchiver serialization. + + @see name + @param name The name of the cache. + @param prefix The prefix for the cache name. Defaults to com.pinterest.PINDiskCache + @param rootPath The path of the cache. + @param serializer A block used to serialize object. If nil provided, default NSKeyedArchiver serialized will be used. + @param deserializer A block used to deserialize object. If nil provided, default NSKeyedUnarchiver serialized will be used. + @param keyEncoder A block used to encode key(filename). If nil provided, default url encoder will be used + @param keyDecoder A block used to decode key(filename). If nil provided, default url decoder will be used + @param operationQueue A PINOperationQueue to run asynchronous operations + @result A new cache with the specified name. + */ +- (instancetype)initWithName:(nonnull NSString *)name + prefix:(nonnull NSString *)prefix + rootPath:(nonnull NSString *)rootPath + serializer:(nullable PINDiskCacheSerializerBlock)serializer + deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer + keyEncoder:(nullable PINDiskCacheKeyEncoderBlock)keyEncoder + keyDecoder:(nullable PINDiskCacheKeyDecoderBlock)keyDecoder + operationQueue:(nonnull PINOperationQueue *)operationQueue NS_DESIGNATED_INITIALIZER; + +#pragma mark - Asynchronous Methods +/// @name Asynchronous Methods +/** + Locks access to ivars and allows safe interaction with files on disk. This method returns immediately. + + @warning Calling synchronous methods on the diskCache inside this block will likely cause a deadlock. + + @param block A block to be executed when a lock is available. + */ +- (void)lockFileAccessWhileExecutingBlockAsync:(PINCacheBlock)block; + +/** + Retrieves the object for the specified key. This method returns immediately and executes the passed + block as soon as the object is available. + + @param key The key associated with the requested object. + @param block A block to be executed serially when the object is available. + */ +- (void)objectForKeyAsync:(NSString *)key completion:(nullable PINDiskCacheObjectBlock)block; + +/** + Retrieves the fileURL for the specified key without actually reading the data from disk. This method + returns immediately and executes the passed block as soon as the object is available. + + @warning Access is protected for the duration of the block, but to maintain safe disk access do not + access this fileURL after the block has ended. + + @warning The PINDiskCache lock is held while block is executed. Any synchronous calls to the diskcache + or a cache which owns the instance of the disk cache are likely to cause a deadlock. This is why the block is + *not* passed the instance of the disk cache. You should also avoid doing extensive work while this + lock is held. + + @param key The key associated with the requested object. + @param block A block to be executed serially when the file URL is available. + */ +- (void)fileURLForKeyAsync:(NSString *)key completion:(PINDiskCacheFileURLBlock)block; + +/** + Stores an object in the cache for the specified key. This method returns immediately and executes the + passed block as soon as the object has been stored. + + @param object An object to store in the cache. + @param key A key to associate with the object. This string will be copied. + @param block A block to be executed serially after the object has been stored, or nil. + */ +- (void)setObjectAsync:(id )object forKey:(NSString *)key completion:(nullable PINDiskCacheObjectBlock)block; + +/** + Stores an object in the cache for the specified key and the specified memory cost. If the cost causes the total + to go over the the cache is trimmed (oldest objects first). This method returns immediately + and executes the passed block after the object has been stored, potentially in parallel with other blocks + on the . + + @param object An object to store in the cache. + @param key A key to associate with the object. This string will be copied. + @param cost An amount to add to the . + @param block A block to be executed concurrently after the object has been stored, or nil. + */ +- (void)setObjectAsync:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost completion:(nullable PINCacheObjectBlock)block; + +/** + Removes the object for the specified key. This method returns immediately and executes the passed block + as soon as the object has been removed. + + @param key The key associated with the object to be removed. + @param block A block to be executed serially after the object has been removed, or nil. + */ +- (void)removeObjectForKeyAsync:(NSString *)key completion:(nullable PINDiskCacheObjectBlock)block; + +/** + Removes objects from the cache, largest first, until the cache is equal to or smaller than the specified byteCount. + This method returns immediately and executes the passed block as soon as the cache has been trimmed. + + @param byteCount The cache will be trimmed equal to or smaller than this size. + @param block A block to be executed serially after the cache has been trimmed, or nil. + */ +- (void)trimToSizeAsync:(NSUInteger)byteCount completion:(nullable PINCacheBlock)block; + +/** + Removes objects from the cache, ordered by date (least recently used first), until the cache is equal to or smaller + than the specified byteCount. This method returns immediately and executes the passed block as soon as the cache has + been trimmed. + + @param byteCount The cache will be trimmed equal to or smaller than this size. + @param block A block to be executed serially after the cache has been trimmed, or nil. + */ +- (void)trimToSizeByDateAsync:(NSUInteger)byteCount completion:(nullable PINCacheBlock)block; + +/** + Loops through all objects in the cache (reads and writes are suspended during the enumeration). Data is not actually + read from disk, the `object` parameter of the block will be `nil` but the `fileURL` will be available. + This method returns immediately. + + @param block A block to be executed for every object in the cache. + @param completionBlock An optional block to be executed after the enumeration is complete. + + @warning The PINDiskCache lock is held while block is executed. Any synchronous calls to the diskcache + or a cache which owns the instance of the disk cache are likely to cause a deadlock. This is why the block is + *not* passed the instance of the disk cache. You should also avoid doing extensive work while this + lock is held. + + */ +- (void)enumerateObjectsWithBlockAsync:(PINDiskCacheFileURLEnumerationBlock)block completionBlock:(nullable PINCacheBlock)completionBlock; + +#pragma mark - Synchronous Methods +/// @name Synchronous Methods + +/** + Locks access to ivars and allows safe interaction with files on disk. This method only returns once the block + has been run. + + @warning Calling synchronous methods on the diskCache inside this block will likely cause a deadlock. + + @param block A block to be executed when a lock is available. + */ +- (void)synchronouslyLockFileAccessWhileExecutingBlock:(PIN_NOESCAPE PINCacheBlock)block; + +/** + Retrieves the object for the specified key. This method blocks the calling thread until the + object is available. + + @see objectForKeyAsync:completion: + @param key The key associated with the object. + @result The object for the specified key. + */ +- (nullable id )objectForKey:(NSString *)key; + +/** + Retrieves the file URL for the specified key. This method blocks the calling thread until the + url is available. Do not use this URL anywhere except with . This method probably + shouldn't even exist, just use the asynchronous one. + + @see fileURLForKeyAsync:completion: + @param key The key associated with the object. + @result The file URL for the specified key. + */ +- (nullable NSURL *)fileURLForKey:(nullable NSString *)key; + +/** + Stores an object in the cache for the specified key. This method blocks the calling thread until + the object has been stored. + + @see setObjectAsync:forKey:completion: + @param object An object to store in the cache. + @param key A key to associate with the object. This string will be copied. + */ +- (void)setObject:(nullable id )object forKey:(NSString *)key; + +/** + Removes objects from the cache, largest first, until the cache is equal to or smaller than the + specified byteCount. This method blocks the calling thread until the cache has been trimmed. + + @see trimToSizeAsync: + @param byteCount The cache will be trimmed equal to or smaller than this size. + */ +- (void)trimToSize:(NSUInteger)byteCount; + +/** + Removes objects from the cache, ordered by date (least recently used first), until the cache is equal to or + smaller than the specified byteCount. This method blocks the calling thread until the cache has been trimmed. + + @see trimToSizeByDateAsync: + @param byteCount The cache will be trimmed equal to or smaller than this size. + */ +- (void)trimToSizeByDate:(NSUInteger)byteCount; + +/** + Loops through all objects in the cache (reads and writes are suspended during the enumeration). Data is not actually + read from disk, the `object` parameter of the block will be `nil` but the `fileURL` will be available. + This method blocks the calling thread until all objects have been enumerated. + + @see enumerateObjectsWithBlockAsync:completionBlock + @param block A block to be executed for every object in the cache. + + @warning Do not call this method within the event blocks (, etc.) + Instead use the asynchronous version, . + + @warning The PINDiskCache lock is held while block is executed. Any synchronous calls to the diskcache + or a cache which owns the instance of the disk cache are likely to cause a deadlock. This is why the block is + *not* passed the instance of the disk cache. You should also avoid doing extensive work while this + lock is held. + + */ +- (void)enumerateObjectsWithBlock:(PIN_NOESCAPE PINDiskCacheFileURLEnumerationBlock)block; + +@end + + +#pragma mark - Deprecated + +/** + A callback block which provides only the cache as an argument + */ +typedef void (^PINDiskCacheBlock)(PINDiskCache *cache); + +@interface PINDiskCache (Deprecated) +- (void)lockFileAccessWhileExecutingBlock:(nullable PINCacheBlock)block __attribute__((deprecated)); +- (void)containsObjectForKey:(NSString *)key block:(PINDiskCacheContainsBlock)block __attribute__((deprecated)); +- (void)objectForKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block __attribute__((deprecated)); +- (void)fileURLForKey:(NSString *)key block:(nullable PINDiskCacheFileURLBlock)block __attribute__((deprecated)); +- (void)setObject:(id )object forKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block __attribute__((deprecated)); +- (void)removeObjectForKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block __attribute__((deprecated)); +- (void)trimToDate:(NSDate *)date block:(nullable PINDiskCacheBlock)block __attribute__((deprecated)); +- (void)trimToSize:(NSUInteger)byteCount block:(nullable PINDiskCacheBlock)block __attribute__((deprecated)); +- (void)trimToSizeByDate:(NSUInteger)byteCount block:(nullable PINDiskCacheBlock)block __attribute__((deprecated)); +- (void)removeAllObjects:(nullable PINDiskCacheBlock)block __attribute__((deprecated)); +- (void)enumerateObjectsWithBlock:(PINDiskCacheFileURLBlock)block completionBlock:(nullable PINDiskCacheBlock)completionBlock __attribute__((deprecated)); +@end + +NS_ASSUME_NONNULL_END diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINMemoryCache.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINMemoryCache.h new file mode 100644 index 0000000..5eee26a --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Headers/PINMemoryCache.h @@ -0,0 +1,239 @@ +// PINCache is a modified version of TMCache +// Modifications by Garrett Moon +// Copyright (c) 2015 Pinterest. All rights reserved. + +#import + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PINMemoryCache; +@class PINOperationQueue; + + +/** + `PINMemoryCache` is a fast, thread safe key/value store similar to `NSCache`. On iOS it will clear itself + automatically to reduce memory usage when the app receives a memory warning or goes into the background. + + Access is natively synchronous. Asynchronous variations are provided. Every asynchronous method accepts a + callback block that runs on a concurrent , with cache reads and writes protected by a lock. + + All access to the cache is dated so the that the least-used objects can be trimmed first. Setting an + optional will trigger a GCD timer to periodically to trim the cache to that age. + + Objects can optionally be set with a "cost", which could be a byte count or any other meaningful integer. + Setting a will automatically keep the cache below that value with . + + Values will not persist after application relaunch or returning from the background. See for + a memory cache backed by a disk cache. + */ + +PIN_SUBCLASSING_RESTRICTED +@interface PINMemoryCache : NSObject + +#pragma mark - Properties +/// @name Core + +/** + The total accumulated cost. + */ +@property (readonly) NSUInteger totalCost; + +/** + The maximum cost allowed to accumulate before objects begin to be removed with . + */ +@property (assign) NSUInteger costLimit; + +/** + The maximum number of seconds an object is allowed to exist in the cache. Setting this to a value + greater than `0.0` will start a recurring GCD timer with the same period that calls . + Setting it back to `0.0` will stop the timer. Defaults to `0.0`. + */ +@property (assign) NSTimeInterval ageLimit; + +/** + If ttlCache is YES, the cache behaves like a ttlCache. This means that once an object enters the + cache, it only lives as long as self.ageLimit. This has the following implications: + - Accessing an object in the cache does not extend that object's lifetime in the cache + - When attempting to access an object in the cache that has lived longer than self.ageLimit, + the cache will behave as if the object does not exist + + */ +@property (nonatomic, assign, getter=isTTLCache) BOOL ttlCache; + +/** + When `YES` on iOS the cache will remove all objects when the app receives a memory warning. + Defaults to `YES`. + */ +@property (assign) BOOL removeAllObjectsOnMemoryWarning; + +/** + When `YES` on iOS the cache will remove all objects when the app enters the background. + Defaults to `YES`. + */ +@property (assign) BOOL removeAllObjectsOnEnteringBackground; + +#pragma mark - Event Blocks +/// @name Event Blocks + +/** + A block to be executed just before an object is added to the cache. This block will be excuted within + a lock, i.e. all reads and writes are suspended for the duration of the block. + Calling synchronous methods on the cache within this callback will likely cause a deadlock. + */ +@property (nullable, copy) PINCacheObjectBlock willAddObjectBlock; + +/** + A block to be executed just before an object is removed from the cache. This block will be excuted + within a lock, i.e. all reads and writes are suspended for the duration of the block. + Calling synchronous methods on the cache within this callback will likely cause a deadlock. + */ +@property (nullable, copy) PINCacheObjectBlock willRemoveObjectBlock; + +/** + A block to be executed just before all objects are removed from the cache as a result of . + This block will be excuted within a lock, i.e. all reads and writes are suspended for the duration of the block. + Calling synchronous methods on the cache within this callback will likely cause a deadlock. + */ +@property (nullable, copy) PINCacheBlock willRemoveAllObjectsBlock; + +/** + A block to be executed just after an object is added to the cache. This block will be excuted within + a lock, i.e. all reads and writes are suspended for the duration of the block. + Calling synchronous methods on the cache within this callback will likely cause a deadlock. + */ +@property (nullable, copy) PINCacheObjectBlock didAddObjectBlock; + +/** + A block to be executed just after an object is removed from the cache. This block will be excuted + within a lock, i.e. all reads and writes are suspended for the duration of the block. + Calling synchronous methods on the cache within this callback will likely cause a deadlock. + */ +@property (nullable, copy) PINCacheObjectBlock didRemoveObjectBlock; + +/** + A block to be executed just after all objects are removed from the cache as a result of . + This block will be excuted within a lock, i.e. all reads and writes are suspended for the duration of the block. + Calling synchronous methods on the cache within this callback will likely cause a deadlock. + */ +@property (nullable, copy) PINCacheBlock didRemoveAllObjectsBlock; + +/** + A block to be executed upon receiving a memory warning (iOS only) potentially in parallel with other blocks on the . + This block will be executed regardless of the value of . Defaults to `nil`. + */ +@property (nullable, copy) PINCacheBlock didReceiveMemoryWarningBlock; + +/** + A block to be executed when the app enters the background (iOS only) potentially in parallel with other blocks on the . + This block will be executed regardless of the value of . Defaults to `nil`. + */ +@property (nullable, copy) PINCacheBlock didEnterBackgroundBlock; + +#pragma mark - Lifecycle +/// @name Shared Cache + +/** + A shared cache. + + @result The shared singleton cache instance. + */ +@property (class, strong, readonly) PINMemoryCache *sharedCache; + +- (instancetype)initWithOperationQueue:(PINOperationQueue *)operationQueue; + +- (instancetype)initWithName:(NSString *)name operationQueue:(PINOperationQueue *)operationQueue NS_DESIGNATED_INITIALIZER; + +#pragma mark - Asynchronous Methods +/// @name Asynchronous Methods + +/** + Removes objects from the cache, costliest objects first, until the is below the specified + value. This method returns immediately and executes the passed block after the cache has been trimmed, + potentially in parallel with other blocks on the . + + @param cost The total accumulation allowed to remain after the cache has been trimmed. + @param block A block to be executed concurrently after the cache has been trimmed, or nil. + */ +- (void)trimToCostAsync:(NSUInteger)cost completion:(nullable PINCacheBlock)block; + +/** + Removes objects from the cache, ordered by date (least recently used first), until the is below + the specified value. This method returns immediately and executes the passed block after the cache has been + trimmed, potentially in parallel with other blocks on the . + + @param cost The total accumulation allowed to remain after the cache has been trimmed. + @param block A block to be executed concurrently after the cache has been trimmed, or nil. + */ +- (void)trimToCostByDateAsync:(NSUInteger)cost completion:(nullable PINCacheBlock)block; + +/** + Loops through all objects in the cache with reads and writes suspended. Calling serial methods which + write to the cache inside block may be unsafe and may result in a deadlock. This method returns immediately. + + @param block A block to be executed for every object in the cache. + @param completionBlock An optional block to be executed concurrently when the enumeration is complete. + */ +- (void)enumerateObjectsWithBlockAsync:(PINCacheObjectEnumerationBlock)block completionBlock:(nullable PINCacheBlock)completionBlock; + +#pragma mark - Synchronous Methods +/// @name Synchronous Methods + +/** + Removes objects from the cache, costliest objects first, until the is below the specified + value. This method blocks the calling thread until the cache has been trimmed. + + @see trimToCostAsync: + @param cost The total accumulation allowed to remain after the cache has been trimmed. + */ +- (void)trimToCost:(NSUInteger)cost; + +/** + Removes objects from the cache, ordered by date (least recently used first), until the is below + the specified value. This method blocks the calling thread until the cache has been trimmed. + + @see trimToCostByDateAsync: + @param cost The total accumulation allowed to remain after the cache has been trimmed. + */ +- (void)trimToCostByDate:(NSUInteger)cost; + +/** + Loops through all objects in the cache within a memory lock (reads and writes are suspended during the enumeration). + This method blocks the calling thread until all objects have been enumerated. + Calling synchronous methods on the cache within this callback will likely cause a deadlock. + + @see enumerateObjectsWithBlockAsync:completionBlock: + @param block A block to be executed for every object in the cache. + + @warning Do not call this method within the event blocks (, etc.) + Instead use the asynchronous version, . + + */ +- (void)enumerateObjectsWithBlock:(PIN_NOESCAPE PINCacheObjectEnumerationBlock)block; + +@end + + +#pragma mark - Deprecated + +typedef void (^PINMemoryCacheBlock)(PINMemoryCache *cache); +typedef void (^PINMemoryCacheObjectBlock)(PINMemoryCache *cache, NSString *key, id _Nullable object); +typedef void (^PINMemoryCacheContainmentBlock)(BOOL containsObject); + +@interface PINMemoryCache (Deprecated) +- (void)containsObjectForKey:(NSString *)key block:(PINMemoryCacheContainmentBlock)block __attribute__((deprecated)); +- (void)objectForKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block __attribute__((deprecated)); +- (void)setObject:(id)object forKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block __attribute__((deprecated)); +- (void)setObject:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost block:(nullable PINMemoryCacheObjectBlock)block __attribute__((deprecated)); +- (void)removeObjectForKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block __attribute__((deprecated)); +- (void)trimToDate:(NSDate *)date block:(nullable PINMemoryCacheBlock)block __attribute__((deprecated)); +- (void)trimToCost:(NSUInteger)cost block:(nullable PINMemoryCacheBlock)block __attribute__((deprecated)); +- (void)trimToCostByDate:(NSUInteger)cost block:(nullable PINMemoryCacheBlock)block __attribute__((deprecated)); +- (void)removeAllObjects:(nullable PINMemoryCacheBlock)block __attribute__((deprecated)); +- (void)enumerateObjectsWithBlock:(PINMemoryCacheObjectBlock)block completionBlock:(nullable PINMemoryCacheBlock)completionBlock __attribute__((deprecated)); +@end + +NS_ASSUME_NONNULL_END diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Info.plist b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Info.plist new file mode 100644 index 0000000..82318f8 Binary files /dev/null and b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Info.plist differ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Modules/module.modulemap b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Modules/module.modulemap new file mode 100644 index 0000000..99a06ee --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module PINCache { + umbrella header "PINCache.h" + + export * + module * { export * } +} diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/PINCache b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/PINCache new file mode 100755 index 0000000..495c658 Binary files /dev/null and b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINCache.framework/PINCache differ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperation.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperation.h new file mode 100644 index 0000000..1f67472 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperation.h @@ -0,0 +1,12 @@ +// +// PINOperation.h +// PINOperation +// +// Created by Adlai Holler on 1/10/17. +// Copyright © 2017 Pinterest. All rights reserved. +// + +#import +#import +#import +#import diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationGroup.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationGroup.h new file mode 100644 index 0000000..0ae7dba --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationGroup.h @@ -0,0 +1,38 @@ +// +// PINOperationGroup.h +// PINQueue +// +// Created by Garrett Moon on 10/8/16. +// Copyright © 2016 Pinterest. All rights reserved. +// + +#import +#import "PINOperationTypes.h" +#import "PINOperationMacros.h" + +@class PINOperationQueue; + +NS_ASSUME_NONNULL_BEGIN + +@protocol PINGroupOperationReference; + +PINOP_SUBCLASSING_RESTRICTED +@interface PINOperationGroup : NSObject + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)asyncOperationGroupWithQueue:(PINOperationQueue *)operationQueue; + +- (nullable id )addOperation:(dispatch_block_t)operation; +- (nullable id )addOperation:(dispatch_block_t)operation withPriority:(PINOperationQueuePriority)priority; +- (void)start; +- (void)cancel; +- (void)setCompletion:(dispatch_block_t)completion; +- (void)waitUntilComplete; + +@end + +@protocol PINGroupOperationReference + +@end + +NS_ASSUME_NONNULL_END diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationMacros.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationMacros.h new file mode 100644 index 0000000..5be3a21 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationMacros.h @@ -0,0 +1,15 @@ +// +// PINOperationMacros.h +// PINOperation +// +// Created by Adlai Holler on 1/10/17. +// Copyright © 2017 Pinterest. All rights reserved. +// + +#ifndef PINOP_SUBCLASSING_RESTRICTED +#if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) +#define PINOP_SUBCLASSING_RESTRICTED __attribute__((objc_subclassing_restricted)) +#else +#define PINOP_SUBCLASSING_RESTRICTED +#endif // #if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) +#endif // #ifndef PINOP_SUBCLASSING_RESTRICTED diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationQueue.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationQueue.h new file mode 100644 index 0000000..07eacbe --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationQueue.h @@ -0,0 +1,141 @@ +// +// PINOperationQueue.h +// Pods +// +// Created by Garrett Moon on 8/23/16. +// +// + +#import +#import "PINOperationTypes.h" +#import "PINOperationMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^PINOperationBlock)(id _Nullable data); +typedef _Nullable id(^PINOperationDataCoalescingBlock)(id _Nullable existingData, id _Nullable newData); + +@protocol PINOperationReference; + +PINOP_SUBCLASSING_RESTRICTED +@interface PINOperationQueue : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +/** + * Initializes and returns a newly allocated operation queue with the specified number of maximum concurrent operations. + * + * @param maxConcurrentOperations The maximum number of queued operations that can execute at the same time. + * + */ +- (instancetype)initWithMaxConcurrentOperations:(NSUInteger)maxConcurrentOperations; + +/** + * Initializes and returns a newly allocated operation queue with the specified number of maximum concurrent operations and the concurrent queue they will be scheduled on. + * + * @param maxConcurrentOperations The maximum number of queued operations that can execute at the same time. + * @param concurrentQueue The operation queue to schedule concurrent operations + * + */ +- (instancetype)initWithMaxConcurrentOperations:(NSUInteger)maxConcurrentOperations concurrentQueue:(dispatch_queue_t)concurrentQueue NS_DESIGNATED_INITIALIZER; + +/** + * Returns the shared instance of the PINOperationQueue class. + */ ++ (instancetype)sharedOperationQueue; + +/** + * Adds the specified operation object to the receiver. + * + * @param operation The operation object to be added to the queue. + * + */ +- (id )scheduleOperation:(dispatch_block_t)operation; + +/** + * Adds the specified operation object to the receiver. + * + * @param operation The operation object to be added to the queue. + * @param priority The execution priority of the operation in an operation queue. + */ +- (id )scheduleOperation:(dispatch_block_t)operation withPriority:(PINOperationQueuePriority)priority; + +/** + * Adds the specified operation object to the receiver. + * + * @param operation The operation object to be added to the queue. + * @param priority The execution priority of the operation in an operation queue. + * @param identifier A string that identifies the operations that can be coalesced. + * @param coalescingData The optional data consumed by this operation that needs to be updated/coalesced with data of a new operation when coalescing the two operations happens. + * @param dataCoalescingBlock The optional block called to update/coalesce the data of this operation with data of a new operation when coalescing the two operations happens. + * @param completion The block to execute after the operation finished. + */ +- (id )scheduleOperation:(PINOperationBlock)operation + withPriority:(PINOperationQueuePriority)priority + identifier:(nullable NSString *)identifier + coalescingData:(nullable id)coalescingData + dataCoalescingBlock:(nullable PINOperationDataCoalescingBlock)dataCoalescingBlock + completion:(nullable dispatch_block_t)completion; + +/** + * The maximum number of queued operations that can execute at the same time. + * + * @discussion The value in this property affects only the operations that the current queue has executing at the same time. Other operation queues can also execute their maximum number of operations in parallel. + * Reducing the number of concurrent operations does not affect any operations that are currently executing. + * + * Setting this value to 1 the operations will not be processed by priority as the operations will processed in a FIFO order to prevent deadlocks if operations depend on certain other operations to run in order. + * + */ +@property (assign) NSUInteger maxConcurrentOperations; + +/** + * Marks the operation as cancelled + */ +- (BOOL)cancelOperation:(id )operationReference; + +/** + * Cancels all queued operations + */ +- (void)cancelAllOperations; + +/** + * Blocks the current thread until all of the receiver’s queued and executing operations finish executing. + * + * @discussion When called, this method blocks the current thread and waits for the receiver’s current and queued + * operations to finish executing. While the current thread is blocked, the receiver continues to launch already + * queued operations and monitor those that are executing. + * + * @warning This should never be called from within an operation submitted to the PINOperationQueue as this will result + * in a deadlock. + */ +- (void)waitUntilAllOperationsAreFinished; + +/** + * Sets the priority for a operation via it's reference + * + * @param priority The new priority for the operation + * @param reference The reference for the operation + * + */ +- (void)setOperationPriority:(PINOperationQueuePriority)priority withReference:(id )reference; + +#pragma mark - Deprecated + +- (id )addOperation:(dispatch_block_t)operation __deprecated_msg("Use scheduleOperation: instead."); + +- (id )addOperation:(dispatch_block_t)operation withPriority:(PINOperationQueuePriority)priority __deprecated_msg("Use scheduleOperation:withPriority: instead."); + +- (id )addOperation:(PINOperationBlock)operation + withPriority:(PINOperationQueuePriority)priority + identifier:(nullable NSString *)identifier + coalescingData:(nullable id)coalescingData + dataCoalescingBlock:(nullable PINOperationDataCoalescingBlock)dataCoalescingBlock + completion:(nullable dispatch_block_t)completion __deprecated_msg("Use scheduleOperation:withPriority:identifier:coalescingData:dataCoalescingBlock:completion: instead."); + +@end + +@protocol PINOperationReference + +@end + +NS_ASSUME_NONNULL_END diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationTypes.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationTypes.h new file mode 100644 index 0000000..be7293d --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Headers/PINOperationTypes.h @@ -0,0 +1,15 @@ +// +// PINOperationTypes.h +// PINOperation +// +// Created by Adlai Holler on 1/10/17. +// Copyright © 2017 Pinterest. All rights reserved. +// + +#import + +typedef NS_ENUM(NSUInteger, PINOperationQueuePriority) { + PINOperationQueuePriorityLow, + PINOperationQueuePriorityDefault, + PINOperationQueuePriorityHigh, +}; diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Info.plist b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Info.plist new file mode 100644 index 0000000..6c9fa47 Binary files /dev/null and b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Info.plist differ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Modules/module.modulemap b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Modules/module.modulemap new file mode 100644 index 0000000..acee1d5 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module PINOperation { + umbrella header "PINOperation.h" + + export * + module * { export * } +} diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/PINOperation b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/PINOperation new file mode 100755 index 0000000..5f85482 Binary files /dev/null and b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINOperation.framework/PINOperation differ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/FLAnimatedImageView+PINRemoteImage.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/FLAnimatedImageView+PINRemoteImage.h new file mode 100644 index 0000000..12cc718 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/FLAnimatedImageView+PINRemoteImage.h @@ -0,0 +1,19 @@ +// +// FLAnimatedImageView+PINRemoteImage.h +// Pods +// +// Created by Garrett Moon on 8/17/14. +// +// + +#import "PINRemoteImageMacros.h" +#if USE_FLANIMATED_IMAGE +#import + +#import "PINRemoteImageCategoryManager.h" + +@interface FLAnimatedImageView (PINRemoteImage) + +@end + +#endif \ No newline at end of file diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/NSData+ImageDetectors.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/NSData+ImageDetectors.h new file mode 100644 index 0000000..95cd2a4 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/NSData+ImageDetectors.h @@ -0,0 +1,18 @@ +// +// NSData+ImageDetectors.h +// Pods +// +// Created by Garrett Moon on 11/19/14. +// +// + +#import + +@interface NSData (PINImageDetectors) + +- (BOOL)pin_isGIF; +#ifdef PIN_WEBP +- (BOOL)pin_isWebP; +#endif + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINAlternateRepresentationProvider.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINAlternateRepresentationProvider.h new file mode 100644 index 0000000..d350609 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINAlternateRepresentationProvider.h @@ -0,0 +1,25 @@ +// +// PINAlternateRepresentationProvider.h +// Pods +// +// Created by Garrett Moon on 3/17/16. +// +// + +#import + +#import "PINRemoteImageManager.h" + +@protocol PINRemoteImageManagerAlternateRepresentationProvider +@required + +/** + @discussion This method will be called with data off the wire or stored in the cache. Return an object to have it returned as the alternativeRepresentation object in the PINRemoteImageManagerResult. @warning this method can be called on the main thread, be careful of doing expensive work. + */ +- (id)alternateRepresentationWithData:(NSData *)data options:(PINRemoteImageManagerDownloadOptions)options; + +@end + +@interface PINAlternateRepresentationProvider : NSObject + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINAnimatedImage.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINAnimatedImage.h new file mode 100644 index 0000000..c84276d --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINAnimatedImage.h @@ -0,0 +1,163 @@ +// +// PINAnimatedImage.h +// Pods +// +// Created by Garrett Moon on 3/18/16. +// +// + +#import + +#if PIN_TARGET_IOS +#import +#elif PIN_TARGET_MAC +#import +#endif + +#import "PINRemoteImageMacros.h" + +#define PINAnimatedImageDebug 0 + +extern NSString *kPINAnimatedImageErrorDomain; + +/** + PINAnimatedImage decoding and processing errors. + */ +typedef NS_ENUM(NSUInteger, PINAnimatedImageError) { + /** No error, yay! */ + PINAnimatedImageErrorNoError = 0, + /** Could not create a necessary file. */ + PINAnimatedImageErrorFileCreationError, + /** Could not get a file handle to the necessary file. */ + PINAnimatedImageErrorFileHandleError, + /** Could not decode the image. */ + PINAnimatedImageErrorImageFrameError, + /** Could not memory map the file. */ + PINAnimatedImageErrorMappingError, + /** File write error */ + PINAnimatedImageErrorFileWrite, +}; + +/** + The processing status of the animated image. + */ +typedef NS_ENUM(NSUInteger, PINAnimatedImageStatus) { + /** No work has been done. */ + PINAnimatedImageStatusUnprocessed = 0, + /** Info about the animated image and the cover image are available. */ + PINAnimatedImageStatusInfoProcessed, + /** At least one set of frames has been decoded to a file. It's safe to start playback. */ + PINAnimatedImageStatusFirstFileProcessed, + /** The entire animated image has been processed. */ + PINAnimatedImageStatusProcessed, + /** Processing was canceled. */ + PINAnimatedImageStatusCanceled, + /** There was an error in processing. */ + PINAnimatedImageStatusError, +}; + +extern const Float32 kPINAnimatedImageDefaultDuration; +extern const Float32 kPINAnimatedImageMinimumDuration; +extern const NSTimeInterval kPINAnimatedImageDisplayRefreshRate; + +/** + Called when the cover image of an animatedImage is ready. + */ +typedef void(^PINAnimatedImageInfoReady)(PINImage *coverImage); + + +/** + PINAnimatedImage is a class which decodes GIFs to memory mapped files on disk. Like PINRemoteImageManager, + it will only decode a GIF one time, regardless of the number of the number of PINAnimatedImages created with + the same NSData. + + PINAnimatedImage's are also decoded chunks at a time, writing each chunk to a separate file. This allows callback + and playback to start before the GIF is completely decoded. If a frame is requested beyond what has been processed, + nil will be returned. Because a fileReady is called on each chunk completion, you can pause playback if you hit a nil + frame until you receive another fileReady call. + + Internally, PINAnimatedImage attempts to keep only the files it needs open – the last file associated with the requested + frame and the one after (to prime). + + It's important to note that until infoCompletion is called, it is unsafe to access many of the methods on PINAnimatedImage. + */ +@interface PINAnimatedImage : NSObject + +- (instancetype)initWithAnimatedImageData:(NSData *)animatedImageData NS_DESIGNATED_INITIALIZER; + +/** + A block to be called on when GIF info has been processed. Status will == PINAnimatedImageStatusInfoProcessed + */ +@property (nonatomic, strong, readwrite) PINAnimatedImageInfoReady infoCompletion; +/** + A block to be called whenever a new file is done being processed. You can start (or resume) playback when you + get this callback, though it's possible for playback to catch up to the decoding and you'll need to pause. + */ +@property (nonatomic, strong, readwrite) dispatch_block_t fileReady; +/** + A block to be called when the animated image is fully decoded and written to disk. + */ +@property (nonatomic, strong, readwrite) dispatch_block_t animatedImageReady; + +/** + The current status of the animated image. + */ +@property (nonatomic, assign, readwrite) PINAnimatedImageStatus status; + +/** + A helper function which references status to check if the coverImage is ready. + */ +@property (nonatomic, readonly) BOOL coverImageReady; +/** + A helper function which references status to check if playback is ready. + */ +@property (nonatomic, readonly) BOOL playbackReady; +/** + The first frame / cover image of the animated image. + @warning Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. You can check coverImageReady too. + */ +@property (nonatomic, readonly) PINImage *coverImage; +/** + The total duration of one loop of playback. + @warning Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. + */ +@property (nonatomic, readonly) CFTimeInterval totalDuration; +/** + The number of frames to play per second * display refresh rate (defined as 60 which appears to be true on iOS). You probably want to + set this value on a displayLink. + @warning Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. + */ +@property (nonatomic, readonly) NSUInteger frameInterval; +/** + The number of times to loop the animated image. Returns 0 if looping should occur infinitely. + @warning Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. + */ +@property (nonatomic, readonly) size_t loopCount; +/** + The total number of frames in the animated image. + @warning Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. + */ +@property (nonatomic, readonly) size_t frameCount; +/** + Any processing error that may have occured. + */ +@property (nonatomic, readonly) NSError *error; + +/** + The image at the frame index passed in. + @param index The index of the frame to retrieve. + @warning Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. + */ +- (CGImageRef)imageAtIndex:(NSUInteger)index; +/** + The duration of the frame of the passed in index. + @param index The index of the frame to retrieve the duration it should be shown for. + @warning Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. + */ +- (CFTimeInterval)durationAtIndex:(NSUInteger)index; +/** + Clears out the strong references to any memory maps that are being held. + */ +- (void)clearAnimatedImageCache; + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINButton+PINRemoteImage.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINButton+PINRemoteImage.h new file mode 100644 index 0000000..95964b1 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINButton+PINRemoteImage.h @@ -0,0 +1,20 @@ +// +// UIButton+PINRemoteImage.h +// Pods +// +// Created by Garrett Moon on 8/18/14. +// +// + +#if PIN_TARGET_IOS +#import +#elif PIN_TARGET_MAC +#import +#endif + +#import "PINRemoteImageManager.h" +#import "PINRemoteImageCategoryManager.h" + +@interface PINButton (PINRemoteImage) + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINCache+PINRemoteImageCaching.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINCache+PINRemoteImageCaching.h new file mode 100644 index 0000000..907b352 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINCache+PINRemoteImageCaching.h @@ -0,0 +1,22 @@ +// +// PINCache+PINRemoteImageCaching.h +// Pods +// +// Created by Aleksei Shevchenko on 7/28/16. +// +// + +#import + +#import "PINRemoteImageCaching.h" +#import "PINRemoteImageManager.h" + +@interface PINCache (PINRemoteImageCaching) + +@end + +@interface PINRemoteImageManager (PINCache) + +@property (nonatomic, nullable, readonly) PINCache *pinCache; + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINImageView+PINRemoteImage.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINImageView+PINRemoteImage.h new file mode 100644 index 0000000..f2b262b --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINImageView+PINRemoteImage.h @@ -0,0 +1,20 @@ +// +// UIImageView+PINRemoteImage.h +// Pods +// +// Created by Garrett Moon on 8/17/14. +// +// + +#if PIN_TARGET_IOS +#import +#elif PIN_TARGET_MAC +#import +#endif + +#import "PINRemoteImageManager.h" +#import "PINRemoteImageCategoryManager.h" + +@interface PINImageView (PINRemoteImage) + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINProgressiveImage.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINProgressiveImage.h new file mode 100644 index 0000000..a6b4589 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINProgressiveImage.h @@ -0,0 +1,53 @@ +// +// PINProgressiveImage.h +// Pods +// +// Created by Garrett Moon on 2/9/15. +// +// + +#import + +#if PIN_TARGET_IOS +#import +#elif PIN_TARGET_MAC +#import +#endif + +#import "PINRemoteImageMacros.h" + +@class PINRemoteImageDownloadTask; + +/** An object which store the data of a downloading image and vends progressive scans **/ +@interface PINProgressiveImage : NSObject + +@property (atomic, copy, nonnull) NSArray *progressThresholds; +@property (atomic, assign) CFTimeInterval estimatedRemainingTimeThreshold; +@property (nonatomic, strong, readonly, nonnull) NSURLSessionDataTask * dataTask; +@property (nonatomic, readonly) float bytesPerSecond; +@property (nonatomic, readonly) CFTimeInterval estimatedRemainingTime; + +- (nonnull instancetype)init NS_UNAVAILABLE; +- (nonnull instancetype)initWithDataTask:(nonnull NSURLSessionDataTask *)dataTask; + +- (void)updateProgressiveImageWithData:(nonnull NSData *)data expectedNumberOfBytes:(int64_t)expectedNumberOfBytes isResume:(BOOL)isResume; + +/** + Returns the latest image based on thresholds, returns nil if no new image is generated + + @param blurred A boolean to indicate if the image should be blurred + @param maxProgressiveRenderSize the maximum dimensions at which to apply a blur. If an image exceeds either the height + or width of this dimension, the image will *not* be blurred regardless of the blurred parameter. + @param renderedImageQuality Value between 0 and 1. Computed by dividing the received number of bytes by the expected number of bytes + @return PINImage a progressive scan of the image or nil if a new one has not been generated + */ +- (nullable PINImage *)currentImageBlurred:(BOOL)blurred maxProgressiveRenderSize:(CGSize)maxProgressiveRenderSize renderedImageQuality:(nonnull out CGFloat *)renderedImageQuality; + +/** + Returns the current data for the image. + + @return NSData the current data for the image + */ +- (nullable NSData *)data; + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImage.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImage.h new file mode 100644 index 0000000..57e21e2 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImage.h @@ -0,0 +1,22 @@ +// +// PINRemoteImage.h +// +// Created by Garrett Moon on 8/17/14. +// +// + +#import "PINRemoteImageMacros.h" + +#if USE_PINCACHE + #import "PINCache+PINRemoteImageCaching.h" +#endif + +#import "NSData+ImageDetectors.h" +#import "PINAlternateRepresentationProvider.h" +#import "PINAnimatedImage.h" +#import "PINRemoteImageManager.h" +#import "PINRemoteImageCategoryManager.h" +#import "PINRemoteImageManagerResult.h" +#import "PINRemoteImageCaching.h" +#import "PINProgressiveImage.h" +#import "PINURLSessionManager.h" diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageCaching.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageCaching.h new file mode 100644 index 0000000..455ba1d --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageCaching.h @@ -0,0 +1,49 @@ +// +// PINRemoteImageCaching.h +// Pods +// +// Created by Aleksei Shevchenko on 7/25/16. +// +// + +#import + + +NS_ASSUME_NONNULL_BEGIN + +@protocol PINRemoteImageCaching; +typedef void (^PINRemoteImageCachingObjectBlock)(id cache, NSString *key, id __nullable object); + +/** + * Image Cache is responsible for actual image caching. + */ +@protocol PINRemoteImageCaching + +//****************************************************************************************************** +// Memory cache methods +//****************************************************************************************************** +- (nullable id)objectFromMemoryForKey:(NSString *)key; +- (void)setObjectInMemory:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost; + +//****************************************************************************************************** +// Disk cache methods +//****************************************************************************************************** +- (nullable id)objectFromDiskForKey:(NSString *)key; +- (void)objectFromDiskForKey:(NSString *)key completion:(nullable PINRemoteImageCachingObjectBlock)completion; +- (void)setObjectOnDisk:(id)object forKey:(NSString *)key; + + +- (BOOL)objectExistsForKey:(NSString *)key; + +- (void)removeObjectForKey:(NSString *)key; +- (void)removeObjectForKey:(NSString *)key completion:(nullable PINRemoteImageCachingObjectBlock)completion; +- (void)removeAllObjects; + +@optional + +- (void)removeObjectForKeyFromMemory:(NSString *)key; + +@end + + +NS_ASSUME_NONNULL_END diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageCategoryManager.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageCategoryManager.h new file mode 100644 index 0000000..aad5688 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageCategoryManager.h @@ -0,0 +1,228 @@ +// +// PINRemoteImageCategory.h +// Pods +// +// Created by Garrett Moon on 11/4/14. +// +// + +#if PIN_TARGET_IOS +#import +#elif PIN_TARGET_MAC +#import +#endif + +#import "PINRemoteImageManager.h" + +@protocol PINRemoteImageCategory; + +/** + PINRemoteImageCategoryManager is a class that handles subclassing image display classes. PINImageView+PINRemoteImage, UIButton+PINRemoteImage, etc, all delegate their work to this class. If you'd like to create a category to display an image on a view, you should mimic one of the above categories. + */ + +@interface PINRemoteImageCategoryManager : NSObject + ++ (void)setImageOnView:(nonnull id )view + fromURL:(nullable NSURL *)url; + ++ (void)setImageOnView:(nonnull id )view + fromURL:(nullable NSURL *)url + placeholderImage:(nullable PINImage *)placeholderImage; + ++ (void)setImageOnView:(nonnull id )view + fromURL:(nullable NSURL *)url + placeholderImage:(nullable PINImage *)placeholderImage + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + ++ (void)setImageOnView:(nonnull id )view + fromURL:(nullable NSURL *)url + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + ++ (void)setImageOnView:(nonnull id )view + fromURL:(nullable NSURL *)url + processorKey:(nullable NSString *)processorKey + processor:(nullable PINRemoteImageManagerImageProcessor)processor; + ++ (void)setImageOnView:(nonnull id )view + fromURL:(nullable NSURL *)url + placeholderImage:(nullable PINImage *)placeholderImage + processorKey:(nullable NSString *)processorKey + processor:(nullable PINRemoteImageManagerImageProcessor)processor; + ++ (void)setImageOnView:(nonnull id )view + fromURL:(nullable NSURL *)url + processorKey:(nullable NSString *)processorKey + processor:(nullable PINRemoteImageManagerImageProcessor)processor + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + ++ (void)setImageOnView:(nonnull id )view + fromURLs:(nullable NSArray *)urls + placeholderImage:(nullable PINImage *)placeholderImage + processorKey:(nullable NSString *)processorKey + processor:(nullable PINRemoteImageManagerImageProcessor)processor + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + ++ (void)setImageOnView:(nonnull id )view + fromURLs:(nullable NSArray *)urls; + ++ (void)setImageOnView:(nonnull id )view + fromURLs:(nullable NSArray *)urls + placeholderImage:(nullable PINImage *)placeholderImage; + ++ (void)setImageOnView:(nonnull id )view + fromURLs:(nullable NSArray *)urls + placeholderImage:(nullable PINImage *)placeholderImage + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + ++ (void)cancelImageDownloadOnView:(nonnull id )view; + ++ (nullable NSUUID *)downloadImageOperationUUIDOnView:(nonnull id )view; + ++ (void)setDownloadImageOperationUUID:(nullable NSUUID *)downloadImageOperationUUID onView:(nonnull id )view; + ++ (BOOL)updateWithProgressOnView:(nonnull id )view; + ++ (void)setUpdateWithProgressOnView:(BOOL)updateWithProgress onView:(nonnull id )view; + +@end + +/** + Protocol to implement on UIView subclasses to support PINRemoteImage + */ +@protocol PINRemoteImageCategory + +//Call manager + +/** + Set the image from the given URL. + + @param url NSURL to fetch from. + */ +- (void)pin_setImageFromURL:(nullable NSURL *)url; + +/** + Set the image from the given URL and set placeholder image while image at URL is being retrieved. + + @param url NSURL to fetch from. + @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. + */ +- (void)pin_setImageFromURL:(nullable NSURL *)url placeholderImage:(nullable PINImage *)placeholderImage; + +/** + Set the image from the given URL and call completion when finished. + + @param url NSURL to fetch from. + @param completion Called when url has been retrieved and set on view. + */ +- (void)pin_setImageFromURL:(nullable NSURL *)url completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Set the image from the given URL, set placeholder while image at url is being retrieved and call completion when finished. + + @param url NSURL to fetch from. + @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. + @param completion Called when url has been retrieved and set on view. + */ +- (void)pin_setImageFromURL:(nullable NSURL *)url placeholderImage:(nullable PINImage *)placeholderImage completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Retrieve the image from the given URL, process it using the passed in processor block and set result on view. + + @param url NSURL to fetch from. + @param processorKey NSString key to uniquely identify processor. Used in caching. + @param processor PINRemoteImageManagerImageProcessor processor block which should return the processed image. + */ +- (void)pin_setImageFromURL:(nullable NSURL *)url processorKey:(nullable NSString *)processorKey processor:(nullable PINRemoteImageManagerImageProcessor)processor; + +/** + Set placeholder on view and retrieve the image from the given URL, process it using the passed in processor block and set result on view. + + @param url NSURL to fetch from. + @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. + @param processorKey NSString key to uniquely identify processor. Used in caching. + @param processor PINRemoteImageManagerImageProcessor processor block which should return the processed image. + */ +- (void)pin_setImageFromURL:(nullable NSURL *)url placeholderImage:(nullable PINImage *)placeholderImage processorKey:(nullable NSString *)processorKey processor:(nullable PINRemoteImageManagerImageProcessor)processor; + +/** + Retrieve the image from the given URL, process it using the passed in processor block and set result on view. Call completion after image has been fetched, processed and set on view. + + @param url NSURL to fetch from. + @param processorKey NSString key to uniquely identify processor. Used in caching. + @param processor PINRemoteImageManagerImageProcessor processor block which should return the processed image. + @param completion Called when url has been retrieved and set on view. + */ +- (void)pin_setImageFromURL:(nullable NSURL *)url processorKey:(nullable NSString *)processorKey processor:(nullable PINRemoteImageManagerImageProcessor)processor completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Set placeholder on view and retrieve the image from the given URL, process it using the passed in processor block and set result on view. Call completion after image has been fetched, processed and set on view. + + @param url NSURL to fetch from. + @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. + @param processorKey NSString key to uniquely identify processor. Used in caching. + @param processor PINRemoteImageManagerImageProcessor processor block which should return the processed image. + @param completion Called when url has been retrieved and set on view. + */ +- (void)pin_setImageFromURL:(nullable NSURL *)url placeholderImage:(nullable PINImage *)placeholderImage processorKey:(nullable NSString *)processorKey processor:(nullable PINRemoteImageManagerImageProcessor)processor completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Retrieve one of the images at the passed in URLs depending on previous network performance and set result on view. + + @param urls NSArray of NSURLs sorted in increasing quality + */ +- (void)pin_setImageFromURLs:(nullable NSArray *)urls; + +/** + Set placeholder on view and retrieve one of the images at the passed in URLs depending on previous network performance and set result on view. + + @param urls NSArray of NSURLs sorted in increasing quality + @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. + */ +- (void)pin_setImageFromURLs:(nullable NSArray *)urls placeholderImage:(nullable PINImage *)placeholderImage; + +/** + Set placeholder on view and retrieve one of the images at the passed in URLs depending on previous network performance and set result on view. Call completion after image has been fetched and set on view. + + @param urls NSArray of NSURLs sorted in increasing quality + @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. + @param completion Called when url has been retrieved and set on view. + */ +- (void)pin_setImageFromURLs:(nullable NSArray *)urls placeholderImage:(nullable PINImage *)placeholderImage completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Cancels the image download. Guarantees that previous setImage calls will *not* have their results set on the image view after calling this (as opposed to PINRemoteImageManager which does not guarantee cancellation). + */ +- (void)pin_cancelImageDownload; + +/** + Returns the NSUUID associated with any PINRemoteImage task currently running on the view. + + @return NSUUID associated with any PINRemoteImage task currently running on the view. + */ +- (nullable NSUUID *)pin_downloadImageOperationUUID; + +/** + Set the current NSUUID associated with a PINRemoteImage task running on the view. + + @param downloadImageOperationUUID NSUUID associated with a PINRemoteImage task. + */ +- (void)pin_setDownloadImageOperationUUID:(nullable NSUUID *)downloadImageOperationUUID; + +/** + Whether the view should update with progress images (such as those provided by progressive JPEG images). + + @return BOOL value indicating whether the view should update with progress images + */ +@property (nonatomic, assign) BOOL pin_updateWithProgress; + +//Handle +- (void)pin_setPlaceholderWithImage:(nullable PINImage *)image; +- (void)pin_updateUIWithRemoteImageManagerResult:(nonnull PINRemoteImageManagerResult *)result; +- (void)pin_clearImages; +- (BOOL)pin_ignoreGIFs; + +@optional + +- (PINRemoteImageManagerDownloadOptions)pin_defaultOptions; + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageMacros.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageMacros.h new file mode 100644 index 0000000..d17160e --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageMacros.h @@ -0,0 +1,65 @@ +// +// PINRemoteImageMacros.h +// PINRemoteImage +// + +#import + +#ifndef PINRemoteImageMacros_h +#define PINRemoteImageMacros_h + +#define PIN_TARGET_IOS (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || TARGET_OS_TV) +#define PIN_TARGET_MAC (TARGET_OS_MAC) + +#define PINRemoteImageLogging 0 +#if PINRemoteImageLogging +#define PINLog(args...) NSLog(args) +#else +#define PINLog(args...) +#endif + +#if __has_include() +#define USE_FLANIMATED_IMAGE 1 +#else +#define USE_FLANIMATED_IMAGE 0 +#endif + +#if __has_include() +#define USE_PINCACHE 1 +#else +#define USE_PINCACHE 0 +#endif + +#if PIN_TARGET_IOS +#define PINImage UIImage +#define PINImageView UIImageView +#define PINButton UIButton +#define PINNSOperationSupportsBlur (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) +#define PINNSURLSessionTaskSupportsPriority (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) +#elif PIN_TARGET_MAC +#define PINImage NSImage +#define PINImageView NSImageView +#define PINButton NSButton +#define PINNSOperationSupportsBlur (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_10) +#define PINNSURLSessionTaskSupportsPriority (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_10) +#endif + +#define PINWeakify(var) __weak typeof(var) PINWeak_##var = var; + +#define PINStrongify(var) \ +_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\"") __strong typeof(var) var = \ +PINWeak_##var; \ +_Pragma("clang diagnostic pop") + +#define BlockAssert(condition, desc, ...) \ +do { \ +__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ +if (!(condition)) { \ +[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \ +object:strongSelf file:[NSString stringWithUTF8String:__FILE__] \ +lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \ +} \ +__PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \ +} while(0); + +#endif /* PINRemoteImageMacros_h */ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageManager.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageManager.h new file mode 100644 index 0000000..3d2adf0 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageManager.h @@ -0,0 +1,568 @@ +// +// PINRemoteImageManager.h +// Pods +// +// Created by Garrett Moon on 8/17/14. +// +// + +#import + +#if PIN_TARGET_IOS +#import +#elif PIN_TARGET_MAC +#import +#endif + +#import "PINRemoteImageMacros.h" + +#import "PINRemoteImageManagerResult.h" + +@protocol PINRemoteImageManagerAlternateRepresentationProvider; +@protocol PINRemoteImageCaching; + +@class PINRemoteImageManagerResult; + +extern NSString * __nonnull const PINRemoteImageManagerErrorDomain; + +/** + Error codes returned by PINRemoteImage + */ +typedef NS_ENUM(NSUInteger, PINRemoteImageManagerError) { + /** The image failed to decode */ + PINRemoteImageManagerErrorFailedToDecodeImage = 1, + /** The image could not be downloaded and therefore could not be processed */ + PINRemoteImageManagerErrorFailedToFetchImageForProcessing = 2, + /** The image returned by the processor block was nil */ + PINRemoteImageManagerErrorFailedToProcessImage = 3, + /** The image in the cache was invalid */ + PINRemoteImageManagerErrorInvalidItemInCache = 4, + /** The image at the URL was empty */ + PINRemoteImageManagerErrorImageEmpty = 5, +}; + +/** + Options with which to download and process images + */ +typedef NS_OPTIONS(NSUInteger, PINRemoteImageManagerDownloadOptions) { + /** Download and process with default options (no other options set) */ + PINRemoteImageManagerDownloadOptionsNone = 0, + /** Set to disallow any alternate representations such as FLAnimatedImage */ + PINRemoteImageManagerDisallowAlternateRepresentations = 1, + /** Skip decoding the image before returning. This means smaller images returned, but images will be decoded on the main thread when set on an image view */ + PINRemoteImageManagerDownloadOptionsSkipDecode = 1 << 1, + /** Skip the early check of the memory cache */ + PINRemoteImageManagerDownloadOptionsSkipEarlyCheck = 1 << 2, + /** Save processed images as JPEGs in the cache. The default is PNG to support transparency */ + PINRemoteImageManagerSaveProcessedImageAsJPEG = 1 << 3, + /** Ignore cache and force download */ + PINRemoteImageManagerDownloadOptionsIgnoreCache = 1 << 4, + /** Skip download retry */ + PINRemoteImageManagerDownloadOptionsSkipRetry = 1 << 5, +}; + +/** + Priority to download and process image at. + */ +typedef NS_ENUM(NSUInteger, PINRemoteImageManagerPriority) { + /** Low priority */ + PINRemoteImageManagerPriorityLow = 0, + /** Default priority */ + PINRemoteImageManagerPriorityDefault, + /** High priority */ + PINRemoteImageManagerPriorityHigh, + PINRemoteImageManagerPriorityVeryHigh DEPRECATED_ATTRIBUTE = PINRemoteImageManagerPriorityHigh, + PINRemoteImageManagerPriorityVeryLow DEPRECATED_ATTRIBUTE = PINRemoteImageManagerPriorityLow, + PINRemoteImageManagerPriorityMedium DEPRECATED_ATTRIBUTE = PINRemoteImageManagerPriorityDefault, +}; + +float dataTaskPriorityWithImageManagerPriority(PINRemoteImageManagerPriority priority); + +/** + Completion called for many PINRemoteImage tasks as well as progress updates. Passed in a PINRemoteImageManagerResult. + + @param result PINRemoteImageManagerResult which contains the downloaded image. + */ +typedef void (^PINRemoteImageManagerImageCompletion)(PINRemoteImageManagerResult * __nonnull result); + +/** + Processor block to post-process a downloaded image. Passed in a PINRemoteImageManagerResult and a pointer to an NSUInteger which can be updated to indicate the cost of processing the image. + + @param result PINRemoteImageManagerResult which contains the downloaded image. + @param cost NSUInteger point which can be modified to indicate the cost of processing the image. This is used when determining which cache objects to evict on memory pressure. + + @return return the processed UIImage + */ +typedef PINImage * _Nullable(^PINRemoteImageManagerImageProcessor)(PINRemoteImageManagerResult * __nonnull result, NSUInteger * __nonnull cost); + +/** + PINRemoteImageManager is the main workhorse of PINRemoteImage. It is unnecessary to access directly if you simply + wish to download images and have them rendered in a UIImageView, UIButton or FLAnimatedImageView. + + However, if you wish to download images directly, this class is your guy / gal. + + You can use this class to download images, postprocess downloaded images, prefetch images, download images progressively, or download one image in a set of images depending on network performance. + */ + +/** + Completion Handler block which will be forwarded to NSURLSessionTaskDelegate's completion handler + + @param disposition One of several constants that describes how the challenge should be handled. + @param credential The credential that should be used for authentication if disposition is NSURLSessionAuthChallengeUseCredential; otherwise, NULL. + */ +typedef void(^PINRemoteImageManagerAuthenticationChallengeCompletionHandler)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * __nullable credential); + +/** + Authentication challenge handler + + @param task The task whose request requires authentication. + @param challenge An object that contains the request for authentication. + @param aHandler A PINRemoteImageManagerAuthenticationChallengeCompletionHandler, see example for further details. + */ +typedef void(^PINRemoteImageManagerAuthenticationChallenge)(NSURLSessionTask * __nullable task, NSURLAuthenticationChallenge * __nonnull challenge, PINRemoteImageManagerAuthenticationChallengeCompletionHandler __nullable aHandler); + + +/** + Request configuration handler. Used to modify a network request before it is executed. + Useful for adding custom, per-request headers. + + @param request The request about to be executed + */ +typedef NSURLRequest * _Nonnull(^PINRemoteImageManagerRequestConfigurationHandler)(NSURLRequest * __nonnull request); + + +/** + Handler called for many PINRemoteImage tasks providing the progress of the download. + + @param completedBytes Amount of bytes that have been downloaded so far. + @param totalBytes Total amount of bytes in the image being downloaded. + */ +typedef void(^PINRemoteImageManagerProgressDownload)(int64_t completedBytes, int64_t totalBytes); + +/** An image downloading, processing and caching manager. It uses the concept of download and processing tasks to ensure that even if multiple calls to download or process an image are made, it only occurs one time (unless an item is no longer in the cache). PINRemoteImageManager is backed by GCD and safe to access from multiple threads simultaneously. It ensures that images are decoded off the main thread so that animation performance isn't affected. None of its exposed methods allow for synchronous access. However, it is optimized to call completions on the calling thread if an item is in its memory cache. **/ +@interface PINRemoteImageManager : NSObject + +@property (nonatomic, readonly, nonnull) id cache; + +/** + Create and return a PINRemoteImageManager created with the specified configuration. If configuration is nil, [NSURLSessionConfiguration defaultConfiguration] is used. Specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. + @param configuration The configuration used to create the PINRemoteImageManager. + @return A PINRemoteImageManager with the specified configuration. + */ +- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration; + +/** + Create and return a PINRemoteImageManager with the specified configuration and alternative representation delegate. If configuration is nil, [NSURLSessionConfiguration defaultConfiguration] is used. Specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. If alternativeRepresentationProvider is nil, the default is used (and supports FLAnimatedImage). + @param configuration The configuration used to create the PINRemoteImageManager. + @param alternativeRepresentationProvider a delegate which conforms to the PINRemoteImageManagerAlternateRepresentationProvider protocol. Provide a delegate if you want to have non image results. @see PINRemoteImageManagerAlternateRepresentationProvider for an example. + @return A PINRemoteImageManager with the specified configuration. + */ +- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration + alternativeRepresentationProvider:(nullable id )alternativeRepresentationProvider; + +/** + Create and return a PINRemoteImageManager with the specified configuration and alternative representation delegate. If configuration is nil, [NSURLSessionConfiguration defaultConfiguration] is used. Specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. If alternativeRepresentationProvider is nil, the default is used (and supports FLAnimatedImage). + @param configuration The configuration used to create the PINRemoteImageManager. + @param alternativeRepresentationProvider a delegate which conforms to the PINRemoteImageManagerAlternateRepresentationProvider protocol. Provide a delegate if you want to have non image results. @see PINRemoteImageManagerAlternateRepresentationProvider for an example. + @param imageCache Optional delegate which conforms to the PINRemoteImageCaching protocol. Provide a delegate if you want to control image caching. By default, image manager will use most appropriate implementation available (based on PINCache or NSCache, depending on subspec)@see PINRemoteImageBasicCache for an example. + @return A PINRemoteImageManager with the specified configuration. + */ +- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration + alternativeRepresentationProvider:(nullable id )alternativeRepresentationProvider + imageCache:(nullable id)imageCache NS_DESIGNATED_INITIALIZER; + + +/** + Get the shared instance of PINRemoteImageManager + + @return Shared instance of PINRemoteImageManager + */ ++ (nonnull instancetype)sharedImageManager; + +/** + Sets the shared instance of PINRemoteImageManager to an instance with the supplied configuration. If configuration is nil, [NSURLSessionConfiguration ephemeralSessionConfiguration] is used. You specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. This method should not be used if the shared instance has already been created. + + @param configuration The configuration used to create the PINRemoteImageManager. + */ ++ (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration; + + +/** + The result of this method is assigned to self.cache in init. If you wish to provide a customized cache to the manager you can subclass PINRemoteImageManager and return a custom object, implementing PINRemoteImageCaching protocol from this method. Same effect could be achieved by using initWithSessionConfiguration:alternativeRepresentationProvider:imageCache: initializer. + @warning This method is meant only for override. It will be called *once* by an instance of PINRemoteImageManager. The default implementation creates a new cache on every call. If you're looking to access the cache being used by an instance of PINRemoteImageManager, @c cache. + @return An instance of a object, implementing PINRemoteImageCaching protocol. + */ +- (nonnull id)defaultImageCache; + +/** + * Sets a custom header to be included in every request. Headers set from this method will override any header from NSURLSessionConfiguration. + * + * @deprecated Use NSURLSessionConfiguration.HTTPAdditionalHeaders instead + * @param value A value for the header. Pass in nil to remove a previously set value. + * @param header A string field for header. + + */ +- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)header __attribute__((deprecated)); + +/** + Sets the Request Configuration Block. + + @param configurationBlock A PINRemoteImageManagerRequestConfigurationHandler block. + */ +- (void)setRequestConfiguration:(nullable PINRemoteImageManagerRequestConfigurationHandler)configurationBlock; + +/** + Set the Authentication Challenge Block. + + @param challengeBlock A PINRemoteImageManagerAuthenticationChallenge block. + */ +- (void)setAuthenticationChallenge:(nullable PINRemoteImageManagerAuthenticationChallenge)challengeBlock; + +/** + Set the minimum BPS to download the highest quality image in a set. + @see downloadImageWithURLs:options:progressImage:completion: + + @param highQualityBPSThreshold bytes per second minimum. Defaults to 500000. + @param completion Completion to be called once highQualityBPSThreshold has been set. + */ +- (void)setHighQualityBPSThreshold:(float)highQualityBPSThreshold completion:(nullable dispatch_block_t)completion; + +/** + Set the maximum BPS to download the lowest quality image in a set. + @see downloadImageWithURLs:options:progressImage:completion: + + @param lowQualityBPSThreshold bytes per second maximum. Defaults to 50000. + @param completion Completion to be called once lowQualityBPSThreshold has been set. + */ +- (void)setLowQualityBPSThreshold:(float)lowQualityBPSThreshold + completion:(nullable dispatch_block_t)completion; + +/** + Set whether high quality images should be downloaded when a low quality image is cached if network connectivity has improved. + @see downloadImageWithURLs:options:progressImage:completion: + + @param shouldUpgradeLowQualityImages if YES, low quality images will be 'upgraded'. + @param completion Completion to be called once shouldUpgradeLowQualityImages has been set. + */ +- (void)setShouldUpgradeLowQualityImages:(BOOL)shouldUpgradeLowQualityImages + completion:(nullable dispatch_block_t)completion; + +/** + Set the maximum number of concurrent operations (decompressing images, creating gifs, etc). + + @param maxNumberOfConcurrentOperations The maximum number of concurrent operations. Defaults to NSOperationQueueDefaultMaxConcurrentOperationCount. + @param completion Completion to be called once maxNumberOfConcurrentOperations is set. + */ +- (void)setMaxNumberOfConcurrentOperations:(NSInteger)maxNumberOfConcurrentOperations + completion:(nullable dispatch_block_t)completion; + +/** + Set the maximum number of concurrent downloads. + + @param maxNumberOfConcurrentDownloads The maximum number of concurrent downloads. Defaults to 10, maximum 65535. + @param completion Completion to be called once maxNumberOfConcurrentDownloads is set. + */ +- (void)setMaxNumberOfConcurrentDownloads:(NSInteger)maxNumberOfConcurrentDownloads + completion:(nullable dispatch_block_t)completion; + +/** + Set the estimated time remaining to download threshold at which to generate progressive images. Progressive images previews will only be generated if the estimated remaining time on a download is greater than estimatedTimeRemainingThreshold. If estimatedTimeRemainingThreshold is less than or equal to zero, this check is skipped. + + @param estimatedRemainingTimeThreshold The estimated remaining time threshold used to decide to skip progressive rendering. Defaults to 0.1. + @param completion Completion to be called once estimatedTimeRemainingTimeThreshold is set. + */ +- (void)setEstimatedRemainingTimeThresholdForProgressiveDownloads:(NSTimeInterval)estimatedRemainingTimeThreshold + completion:(nullable dispatch_block_t)completion; + +/** + Sets the progress at which progressive images are generated. By default this is @[@0.00, @0.35, @0.65] which generates at most, 3 progressive images. The first progressive image will only be generated when at least one scan has been completed (so you never see half an image). + + @param progressThresholds an array of progress thresholds at which to generate progressive images. progress thresholds should range from 0.00 - 1.00. Defaults to @[@0.00, @0.35, @0.65] + @param completion Completion to be called once progressThresholds is set. + */ +- (void)setProgressThresholds:(nonnull NSArray *)progressThresholds + completion:(nullable dispatch_block_t)completion; + +/** + Sets whether PINRemoteImage should blur progressive render results + + @param shouldBlur A bool value indicating whether PINRemoteImage should blur progressive render results + @param completion Completion to be called once progressThresholds is set. + */ +- (void)setProgressiveRendersShouldBlur:(BOOL)shouldBlur + completion:(nullable dispatch_block_t)completion; + +/** + Sets the maximum size of an image that PINRemoteImage will render progessively. If the image is too large, progressive rendering is skipped. + + @param maxProgressiveRenderSize A CGSize which indicates the max size PINRemoteImage will render a progressive image. If an image is larger in either dimension, progressive rendering will be skipped + @param completion Completion to be called once maxProgressiveRenderSize is set. + */ +- (void)setProgressiveRendersMaxProgressiveRenderSize:(CGSize)maxProgressiveRenderSize + completion:(nullable dispatch_block_t)completion; + +/** + Prefetch an image at the given URL. + + @param url NSURL where the image to prefetch resides. + */ +- (nullable NSUUID *)prefetchImageWithURL:(nonnull NSURL *)url; + +/** + Prefetch an image at the given URL with given options. + + @param url NSURL where the image to prefetch resides. + @param options PINRemoteImageManagerDownloadOptions options with which to pefetch the image. + */ +- (nullable NSUUID *)prefetchImageWithURL:(nonnull NSURL *)url options:(PINRemoteImageManagerDownloadOptions)options; + +/** + Prefetch images at the given URLs. + + @param urls An array of NSURLs where the images to prefetch reside. + */ +- (nonnull NSArray *)prefetchImagesWithURLs:(nonnull NSArray *)urls; + +/** + Prefetch images at the given URLs with given options. + + @param urls An array of NSURLs where the images to prefetch reside. + @param options PINRemoteImageManagerDownloadOptions options with which to pefetch the image. + */ +- (nonnull NSArray *)prefetchImagesWithURLs:(nonnull NSArray *)urls options:(PINRemoteImageManagerDownloadOptions)options; + +/** + Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). + + @param url NSURL where the image to download resides. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. + @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). + */ +- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). + + @param url NSURL where the image to download resides. + @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. + @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). + */ +- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url + options:(PINRemoteImageManagerDownloadOptions)options + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). + + @param url NSURL where the image to download resides. + @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. + @param progressImage PINRemoteImageManagerImageCompletion block which will be called to update progress of the image download. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. + + @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). + */ +- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url + options:(PINRemoteImageManagerDownloadOptions)options + progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). + + @param url NSURL where the image to download resides. + @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. + @param progressDownload PINRemoteImageManagerDownloadProgress block which will be called to update progress in bytes of the image download. NOTE: For performance reasons, this block is not called on the main thread every time, if you need to update your UI ensure that you dispatch to the main thread first. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. + + @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). + */ +- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url + options:(PINRemoteImageManagerDownloadOptions)options + progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). + + @param url NSURL where the image to download resides. + @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. + @param progressImage PINRemoteImageManagerImageCompletion block which will be called to update progress of the image download. + @param progressDownload PINRemoteImageManagerDownloadProgress block which will be called to update progress in bytes of the image download. NOTE: For performance reasons, this block is not called on the main thread every time, if you need to update your UI ensure that you dispatch to the main thread first. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. + + @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). + */ +- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url + options:(PINRemoteImageManagerDownloadOptions)options + progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage + progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Download or retrieve from cache the image found at the url and process it before calling completion. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). + + @param url NSURL where the image to download resides. + @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. + @param processorKey NSString key to uniquely identify processor and process. Will be used for caching processed images. + @param processor PINRemoteImageManagerImageProcessor block which will be called to post-process downloaded image. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. + + @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). + */ +- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url + options:(PINRemoteImageManagerDownloadOptions)options + processorKey:(nullable NSString *)processorKey + processor:(nullable PINRemoteImageManagerImageProcessor)processor + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Download or retrieve from cache the image found at the url and process it before calling completion. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). + + @param url NSURL where the image to download resides. + @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. + @param processorKey NSString key to uniquely identify processor and process. Will be used for caching processed images. + @param progressDownload PINRemoteImageManagerDownloadProgress block which will be called to update progress in bytes of the image download. NOTE: For performance reasons, this block is not called on the main thread every time, if you need to update your UI ensure that you dispatch to the main thread first. + @param processor PINRemoteImageManagerImageProcessor block which will be called to post-process downloaded image. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. + + @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). + */ +- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url + options:(PINRemoteImageManagerDownloadOptions)options + processorKey:(nullable NSString *)processorKey + processor:(nullable PINRemoteImageManagerImageProcessor)processor + progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + +/** + Download or retrieve from cache one of the images found at the urls in the passed in array based on current network performance. URLs should be sorted from lowest quality image URL to highest. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). + + Unless setShouldUpgradeLowQualityImages is set to YES, this method checks the cache for all URLs and returns the highest quality version stored. It is possible though unlikely for a cached image to not be returned if it is still being cached while a call is made to this method and if network conditions have changed. See source for more details. + + @param urls An array of NSURLs of increasing size. + @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. + @param progressImage PINRemoteImageManagerImageCompletion block which will be called to update progress of the image download. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. + + @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). + */ +- (nullable NSUUID *)downloadImageWithURLs:(nonnull NSArray *)urls + options:(PINRemoteImageManagerDownloadOptions)options + progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage + completion:(nullable PINRemoteImageManagerImageCompletion)completion; + + +/** + Adds an image manually into the memory and disk cache. + + @param data NSData with the raw image data. + @param url NSURL where the image resides. + @param processorKey NSString key to uniquely identify processor and process. Will be used for caching processed images. + @param additionalCost NSUInteger the additional cost (for cache eviction purposes) to generate the processed image + + @return A BOOL indicating if the image was successfully added to the cache. + */ +- (BOOL) insertImageDataIntoCache:(nonnull NSData*)data + withURL:(nonnull NSURL *)url + processorKey:(nullable NSString *)processorKey + additionalCost:(NSUInteger)additionalCost; + +/** + Returns the cacheKey for a given URL and processorKey. Exposed to be overridden if necessary or to be used with imageFromCacheWithCacheKey + @see imageFromCacheWithCacheKey:completion: + + @param url NSURL that was used to download image + @param processorKey An optional key to uniquely identify the processor used to post-process the downloaded image. + + @return returns an NSString which is the key used for caching. + */ +- (nonnull NSString *)cacheKeyForURL:(nonnull NSURL *)url processorKey:(nullable NSString *)processorKey; + +/** + @see imageFromCacheWithURL:processorKey:options:completion: + @deprecated + + @param cacheKey NSString key to look up image in the cache. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache. + */ +- (void)imageFromCacheWithCacheKey:(nonnull NSString *)cacheKey completion:(nonnull PINRemoteImageManagerImageCompletion)completion __attribute__((deprecated)); + +/** + @see imageFromCacheWithURL:processorKey:options:completion: + @deprecated + + @param cacheKey NSString key to look up image in the cache. + @param options options will be used to determine if the cached image should be decompressed or FLAnimatedImages should be returned. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache. + */ +- (void)imageFromCacheWithCacheKey:(nonnull NSString *)cacheKey options:(PINRemoteImageManagerDownloadOptions)options completion:(nonnull PINRemoteImageManagerImageCompletion)completion __attribute__((deprecated)); + +/** + Directly get an image from the underlying cache. + + @param url NSURL that was used to download image + @param processorKey An optional key to uniquely identify the processor used to post-process the downloaded image. + @param options options will be used to determine if the cached image should be decompressed or FLAnimatedImages should be returned. + @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache. + */ +- (void)imageFromCacheWithURL:(nonnull NSURL *)url processorKey:(nullable NSString *)processorKey options:(PINRemoteImageManagerDownloadOptions)options completion:(nonnull PINRemoteImageManagerImageCompletion)completion; + +/** + @deprecated + @see synchronousImageFromCacheWithURL:processorKey:options: + + @param cacheKey NSString obtained from @c cacheKeyForURL:processorKey + @param options options will be used to determine if the cached image should be decompressed or FLAnimatedImages should be returned. + + @return A PINRemoteImageManagerResult + */ +- (nonnull PINRemoteImageManagerResult *)synchronousImageFromCacheWithCacheKey:(nonnull NSString *)cacheKey options:(PINRemoteImageManagerDownloadOptions)options __attribute__((deprecated)); + +/** + Directly get an image from the underlying memory cache synchronously. + + @param url NSURL that was used to download image + @param processorKey An optional key to uniquely identify the processor used to post-process the downloaded image. + @param options options will be used to determine if the cached image should be decompressed or FLAnimatedImages should be returned. + + @return A PINRemoteImageManagerResult + */ +- (nonnull PINRemoteImageManagerResult *)synchronousImageFromCacheWithURL:(nonnull NSURL *)url processorKey:(nullable NSString *)processorKey options:(PINRemoteImageManagerDownloadOptions)options; + +/** + Cancel a download. Canceling will only cancel the download if all other downloads are also canceled with their associated UUIDs. + Canceling *does not* guarantee that your completion will not be called. You can use the UUID provided on the result object to verify + the completion you want called is being called. + @see PINRemoteImageCategoryManager + + @param UUID NSUUID of the task to cancel. + */ +- (void)cancelTaskWithUUID:(nonnull NSUUID *)UUID; + +/** + Cancel a download. Canceling will only cancel the download if all other downloads are also canceled with their associated UUIDs. + Canceling *does not* guarantee that your completion will not be called. You can use the UUID provided on the result object to verify + the completion you want called is being called. + @param storeResumeData if YES and the server indicates it supports resuming downloads, downloaded data will be stored in the memory + cache and used to resume the download if the same URL is attempted to be downloaded in the future. + */ +- (void)cancelTaskWithUUID:(nonnull NSUUID *)UUID storeResumeData:(BOOL)storeResumeData; + +/** + Set the priority of a download task. Since there is only one task per download, the priority of the download task will always be the last priority this method was called with. + + @param priority priority to set on the task. + @param UUID NSUUID of the task to set the priority on. + */ +- (void)setPriority:(PINRemoteImageManagerPriority)priority ofTaskWithUUID:(nonnull NSUUID *)UUID; + +/** + * @abstract set the progress callback on a download task. You can use this to add progress callbacks or remove them for in flight downloads + * + * @param progressImageCallback a PINRemoteImageManagerImageCompletion block to be called with a progress update + * @param UUID NSUUID of the task to set the priority on. + */ +- (void)setProgressImageCallback:(nullable PINRemoteImageManagerImageCompletion)progressImageCallback ofTaskWithUUID:(nonnull NSUUID *)UUID; + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageManagerResult.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageManagerResult.h new file mode 100644 index 0000000..b2769f1 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINRemoteImageManagerResult.h @@ -0,0 +1,74 @@ +// +// PINRemoteImageManagerResult.h +// Pods +// +// Created by Garrett Moon on 3/9/15. +// +// + +#import + +#if PIN_TARGET_IOS +#import +#elif PIN_TARGET_MAC +#import +#endif + +#import "PINRemoteImageMacros.h" +#if USE_FLANIMATED_IMAGE +#import +#endif + +/** How the image was fetched. */ +typedef NS_ENUM(NSUInteger, PINRemoteImageResultType) { + /** Returned if no image is returned */ + PINRemoteImageResultTypeNone = 0, + /** Image was fetched from the memory cache */ + PINRemoteImageResultTypeMemoryCache, + /** Image was fetched from the disk cache */ + PINRemoteImageResultTypeCache, + /** Image was downloaded */ + PINRemoteImageResultTypeDownload, + /** Image is progress */ + PINRemoteImageResultTypeProgress, +}; + +@interface PINRemoteImageManagerResult : NSObject + +@property (nonatomic, readonly, strong, nullable) PINImage *image; +@property (nonatomic, readonly, strong, nullable) id alternativeRepresentation; +@property (nonatomic, readonly, assign) NSTimeInterval requestDuration; +@property (nonatomic, readonly, strong, nullable) NSError *error; +@property (nonatomic, readonly, assign) PINRemoteImageResultType resultType; +@property (nonatomic, readonly, strong, nullable) NSUUID *UUID; +@property (nonatomic, readonly, assign) CGFloat renderedImageQuality; +@property (nonatomic, readonly, assign) NSUInteger bytesSavedByResuming; +@property (nonatomic, readonly, strong, nullable) NSURLResponse *response; + ++ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image + alternativeRepresentation:(nullable id)alternativeRepresentation + requestLength:(NSTimeInterval)requestLength + resultType:(PINRemoteImageResultType)resultType + UUID:(nullable NSUUID *)uuid + response:(nullable NSURLResponse *)response + error:(nullable NSError *)error; + ++ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image + alternativeRepresentation:(nullable id)alternativeRepresentation + requestLength:(NSTimeInterval)requestLength + resultType:(PINRemoteImageResultType)resultType + UUID:(nullable NSUUID *)uuid + response:(nullable NSURLResponse *)response + error:(nullable NSError *)error + bytesSavedByResuming:(NSUInteger)bytesSavedByResuming; + ++ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image + alternativeRepresentation:(nullable id)alternativeRepresentation + requestLength:(NSTimeInterval)requestLength + resultType:(PINRemoteImageResultType)resultType + UUID:(nullable NSUUID *)uuid + response:(nullable NSURLResponse *)response + error:(nullable NSError *)error + renderedImageQuality:(CGFloat)renderedImageQuality; + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINURLSessionManager.h b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINURLSessionManager.h new file mode 100644 index 0000000..1077b1b --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Headers/PINURLSessionManager.h @@ -0,0 +1,50 @@ +// +// PINURLSessionManager.h +// Pods +// +// Created by Garrett Moon on 6/26/15. +// +// + +#import + +extern NSString * __nonnull const PINURLErrorDomain; + +@protocol PINURLSessionManagerDelegate + +@required +- (void)didReceiveData:(nonnull NSData *)data forTask:(nonnull NSURLSessionTask *)task; +- (void)didCompleteTask:(nonnull NSURLSessionTask *)task withError:(nullable NSError *)error; + +@optional +- (void)didReceiveResponse:(nonnull NSURLResponse *)response forTask:(nonnull NSURLSessionTask *)task; +- (void)didReceiveAuthenticationChallenge:(nonnull NSURLAuthenticationChallenge *)challenge forTask:(nullable NSURLSessionTask *)task completionHandler:(nonnull void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler; + + +@end + +typedef void (^PINURLSessionDataTaskCompletion)(NSURLSessionTask * _Nonnull task, NSError * _Nullable error); + +@interface PINURLSessionManager : NSObject + +- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration; + +- (nonnull NSURLSessionDataTask *)dataTaskWithRequest:(nonnull NSURLRequest *)request completionHandler:(nonnull PINURLSessionDataTaskCompletion)completionHandler; + +- (void)invalidateSessionAndCancelTasks; + +@property (atomic, weak, nullable) id delegate; + +/* + Returns a weighted average of time to first byte for the specified host. + More specifically, we get the time to first byte for every task that completes + and add it to an existing average: newAverage = (existingAverage + newTimeToFirstByte / 2) + This is all done on a per host basis. + */ +- (NSTimeInterval)weightedTimeToFirstByteForHost:(nonnull NSString *)host; + +#if DEBUG +- (void)concurrentDownloads:(void (^_Nullable)(NSUInteger concurrentDownloads))concurrentDownloadsCompletion; +#endif + +@end diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Info.plist b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Info.plist new file mode 100644 index 0000000..aa174e8 Binary files /dev/null and b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Info.plist differ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Modules/module.modulemap b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Modules/module.modulemap new file mode 100644 index 0000000..2c43df5 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/Modules/module.modulemap @@ -0,0 +1,10 @@ +framework module PINRemoteImage { + umbrella header "PINRemoteImage.h" + + textual header "PINRemoteImageMacros.h" + header "FLAnimatedImageView+PINRemoteImage.h" + header "PINButton+PINRemoteImage.h" + header "PINImageView+PINRemoteImage.h" + + export * +} \ No newline at end of file diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/PINRemoteImage b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/PINRemoteImage new file mode 100755 index 0000000..14f8564 Binary files /dev/null and b/Examples/Swift-Example-Manual/Swift-Example-Manual/Dependencies/PINRemoteImage.framework/PINRemoteImage differ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/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/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/Contents.json b/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/haptik_textLogo.imageset/Contents.json b/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/haptik_textLogo.imageset/Contents.json new file mode 100644 index 0000000..7c8fc35 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/haptik_textLogo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "haptik_textlogo.pdf", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/haptik_textLogo.imageset/haptik_textlogo.pdf b/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/haptik_textLogo.imageset/haptik_textlogo.pdf new file mode 100644 index 0000000..ffda424 Binary files /dev/null and b/Examples/Swift-Example-Manual/Swift-Example-Manual/Resources/Assets.xcassets/haptik_textLogo.imageset/haptik_textlogo.pdf differ diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/SceneDelegate.swift b/Examples/Swift-Example-Manual/Swift-Example-Manual/SceneDelegate.swift new file mode 100644 index 0000000..5f8fe13 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/SceneDelegate.swift @@ -0,0 +1,54 @@ +// +// SceneDelegate.swift +// Swift-Example-Manual +// +// Created by SimranJot Singh on 04/10/19. +// Copyright © 2019 Haptik. All rights reserved. +// + +import UIKit + +@available(iOS 13.0, *) +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Storyboards/Base.lproj/Main.storyboard b/Examples/Swift-Example-Manual/Swift-Example-Manual/Storyboards/Base.lproj/Main.storyboard new file mode 100644 index 0000000..e17925d --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Storyboards/Base.lproj/Main.storyboard @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Supporting Files/Base.lproj/LaunchScreen.storyboard b/Examples/Swift-Example-Manual/Swift-Example-Manual/Supporting Files/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Supporting Files/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Swift-Example-Manual/Swift-Example-Manual/Supporting Files/Info.plist b/Examples/Swift-Example-Manual/Swift-Example-Manual/Supporting Files/Info.plist new file mode 100644 index 0000000..050aa36 --- /dev/null +++ b/Examples/Swift-Example-Manual/Swift-Example-Manual/Supporting Files/Info.plist @@ -0,0 +1,149 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + CleverTapUseIFA + + HaptikLib + + CleverTap + + CleverTapAccountID + + CleverTapToken + + + apiKey + API_KEY_HERE + baseUrl + BASE_URL_HERE + clientID + CLIENT_ID_HERE + runEnvironment + 1 + shareAndRate + + appStoreUrl + + iTunesItemIdentifier + + shareText + + shareUrl + + + teamID + + + NSAppTransportSecurity + + NSExceptionDomains + + haptik-staging.s3.amazonaws.com + + NSIncludesSubdomains + + NSThirdPartyExceptionAllowsInsecureHTTPLoads + + + haptikapi.com + + NSIncludesSubdomains + + NSThirdPartyExceptionAllowsInsecureHTTPLoads + + + haptikdev.s3.amazonaws.com + + NSIncludesSubdomains + + NSThirdPartyExceptionAllowsInsecureHTTPLoads + + + staging.hellohaptik.com + + NSIncludesSubdomains + + NSThirdPartyExceptionAllowsInsecureHTTPLoads + + + + + NSCameraUsageDescription + To enable camera usage for uploading photos + NSPhotoLibraryAddUsageDescription + To enable usage and saving of photos + NSPhotoLibraryUsageDescription + To enable usage and saving of photos + UIAppFonts + + SF-UI-Text-Bold.otf + SF-UI-Text-Light.otf + SF-UI-Text-LightItalic.otf + SF-UI-Text-Medium.otf + SF-UI-Text-MediumItalic.otf + SF-UI-Text-Regular.otf + SF-UI-Text-RegularItalic.otf + SF-UI-Text-Semibold.otf + SF-UI-Text-SemiboldItalic.otf + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Examples/Swift-Example/Swift-Example.xcodeproj/project.pbxproj b/Examples/Swift-Example/Swift-Example.xcodeproj/project.pbxproj index e6d5263..3fb7142 100644 --- a/Examples/Swift-Example/Swift-Example.xcodeproj/project.pbxproj +++ b/Examples/Swift-Example/Swift-Example.xcodeproj/project.pbxproj @@ -3,47 +3,47 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ 36AD21DB3733FBB10062D87F /* Pods_Swift_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2E42887D871BEC4EBCAFFC4 /* Pods_Swift_Example.framework */; }; + 7019E75A23472313008EA97A /* SF-UI-Text-SemiboldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75123472312008EA97A /* SF-UI-Text-SemiboldItalic.otf */; }; + 7019E75B23472313008EA97A /* SF-UI-Text-RegularItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75223472312008EA97A /* SF-UI-Text-RegularItalic.otf */; }; + 7019E75C23472313008EA97A /* SF-UI-Text-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75323472312008EA97A /* SF-UI-Text-Bold.otf */; }; + 7019E75D23472313008EA97A /* SF-UI-Text-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75423472312008EA97A /* SF-UI-Text-Regular.otf */; }; + 7019E75E23472313008EA97A /* SF-UI-Text-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75523472312008EA97A /* SF-UI-Text-Light.otf */; }; + 7019E75F23472313008EA97A /* SF-UI-Text-MediumItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75623472312008EA97A /* SF-UI-Text-MediumItalic.otf */; }; + 7019E76023472313008EA97A /* SF-UI-Text-LightItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75723472312008EA97A /* SF-UI-Text-LightItalic.otf */; }; + 7019E76123472313008EA97A /* SF-UI-Text-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75823472313008EA97A /* SF-UI-Text-Medium.otf */; }; + 7019E76223472313008EA97A /* SF-UI-Text-Semibold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7019E75923472313008EA97A /* SF-UI-Text-Semibold.otf */; }; + 7019E77E2347296C008EA97A /* HelperExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7019E77D2347296B008EA97A /* HelperExtensions.swift */; }; 701A85A521C0B656004C49DD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 701A85A421C0B656004C49DD /* AppDelegate.swift */; }; 701A85A721C0B656004C49DD /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 701A85A621C0B656004C49DD /* RootViewController.swift */; }; 701A85AA21C0B656004C49DD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 701A85A821C0B656004C49DD /* Main.storyboard */; }; 701A85AC21C0B658004C49DD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 701A85AB21C0B658004C49DD /* Assets.xcassets */; }; - 701A85C521C0BFDB004C49DD /* SF-UI-Text-LightItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85BC21C0BFDB004C49DD /* SF-UI-Text-LightItalic.otf */; }; - 701A85C621C0BFDB004C49DD /* SF-UI-Text-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85BD21C0BFDB004C49DD /* SF-UI-Text-Light.otf */; }; - 701A85C721C0BFDB004C49DD /* SF-UI-Text-Semibold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85BE21C0BFDB004C49DD /* SF-UI-Text-Semibold.otf */; }; - 701A85C821C0BFDB004C49DD /* SF-UI-Text-RegularItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85BF21C0BFDB004C49DD /* SF-UI-Text-RegularItalic.otf */; }; - 701A85C921C0BFDB004C49DD /* SF-UI-Text-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85C021C0BFDB004C49DD /* SF-UI-Text-Bold.otf */; }; - 701A85CA21C0BFDB004C49DD /* SF-UI-Text-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85C121C0BFDB004C49DD /* SF-UI-Text-Medium.otf */; }; - 701A85CB21C0BFDB004C49DD /* SF-UI-Text-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85C221C0BFDB004C49DD /* SF-UI-Text-Regular.otf */; }; - 701A85CC21C0BFDB004C49DD /* SF-UI-Text-MediumItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85C321C0BFDB004C49DD /* SF-UI-Text-MediumItalic.otf */; }; - 701A85CD21C0BFDB004C49DD /* SF-UI-Text-SemiboldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 701A85C421C0BFDB004C49DD /* SF-UI-Text-SemiboldItalic.otf */; }; 701A85D421C0C570004C49DD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 701A85D121C0C570004C49DD /* LaunchScreen.storyboard */; }; - 701A85D821C0CD18004C49DD /* HelperExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 701A85D721C0CD18004C49DD /* HelperExtensions.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 09CD2E240BB46EC049F48C5D /* Pods-Swift-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Swift-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Swift-Example/Pods-Swift-Example.release.xcconfig"; sourceTree = ""; }; + 7019E75123472312008EA97A /* SF-UI-Text-SemiboldItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-SemiboldItalic.otf"; sourceTree = ""; }; + 7019E75223472312008EA97A /* SF-UI-Text-RegularItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-RegularItalic.otf"; sourceTree = ""; }; + 7019E75323472312008EA97A /* SF-UI-Text-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Bold.otf"; sourceTree = ""; }; + 7019E75423472312008EA97A /* SF-UI-Text-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Regular.otf"; sourceTree = ""; }; + 7019E75523472312008EA97A /* SF-UI-Text-Light.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Light.otf"; sourceTree = ""; }; + 7019E75623472312008EA97A /* SF-UI-Text-MediumItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-MediumItalic.otf"; sourceTree = ""; }; + 7019E75723472312008EA97A /* SF-UI-Text-LightItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-LightItalic.otf"; sourceTree = ""; }; + 7019E75823472313008EA97A /* SF-UI-Text-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Medium.otf"; sourceTree = ""; }; + 7019E75923472313008EA97A /* SF-UI-Text-Semibold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Semibold.otf"; sourceTree = ""; }; + 7019E77D2347296B008EA97A /* HelperExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelperExtensions.swift; sourceTree = ""; }; 701A85A121C0B656004C49DD /* Swift-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Swift-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 701A85A421C0B656004C49DD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 701A85A621C0B656004C49DD /* RootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = ""; }; 701A85A921C0B656004C49DD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 701A85AB21C0B658004C49DD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 701A85BC21C0BFDB004C49DD /* SF-UI-Text-LightItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-LightItalic.otf"; sourceTree = ""; }; - 701A85BD21C0BFDB004C49DD /* SF-UI-Text-Light.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Light.otf"; sourceTree = ""; }; - 701A85BE21C0BFDB004C49DD /* SF-UI-Text-Semibold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Semibold.otf"; sourceTree = ""; }; - 701A85BF21C0BFDB004C49DD /* SF-UI-Text-RegularItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-RegularItalic.otf"; sourceTree = ""; }; - 701A85C021C0BFDB004C49DD /* SF-UI-Text-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Bold.otf"; sourceTree = ""; }; - 701A85C121C0BFDB004C49DD /* SF-UI-Text-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Medium.otf"; sourceTree = ""; }; - 701A85C221C0BFDB004C49DD /* SF-UI-Text-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Regular.otf"; sourceTree = ""; }; - 701A85C321C0BFDB004C49DD /* SF-UI-Text-MediumItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-MediumItalic.otf"; sourceTree = ""; }; - 701A85C421C0BFDB004C49DD /* SF-UI-Text-SemiboldItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-SemiboldItalic.otf"; sourceTree = ""; }; 701A85CF21C0C570004C49DD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 701A85D221C0C570004C49DD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = LaunchScreen.storyboard; sourceTree = ""; }; - 701A85D721C0CD18004C49DD /* HelperExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelperExtensions.swift; sourceTree = ""; }; C2E42887D871BEC4EBCAFFC4 /* Pods_Swift_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Swift_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D456ADFD8219BD3F27E63E2F /* Pods-Swift-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Swift-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Swift-Example/Pods-Swift-Example.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -77,6 +77,32 @@ name = Pods; sourceTree = ""; }; + 7019E75023472312008EA97A /* Fonts */ = { + isa = PBXGroup; + children = ( + 7019E75123472312008EA97A /* SF-UI-Text-SemiboldItalic.otf */, + 7019E75223472312008EA97A /* SF-UI-Text-RegularItalic.otf */, + 7019E75323472312008EA97A /* SF-UI-Text-Bold.otf */, + 7019E75423472312008EA97A /* SF-UI-Text-Regular.otf */, + 7019E75523472312008EA97A /* SF-UI-Text-Light.otf */, + 7019E75623472312008EA97A /* SF-UI-Text-MediumItalic.otf */, + 7019E75723472312008EA97A /* SF-UI-Text-LightItalic.otf */, + 7019E75823472313008EA97A /* SF-UI-Text-Medium.otf */, + 7019E75923472313008EA97A /* SF-UI-Text-Semibold.otf */, + ); + name = Fonts; + path = ../../../Shared/Fonts; + sourceTree = ""; + }; + 7019E77C2347296B008EA97A /* Extensions */ = { + isa = PBXGroup; + children = ( + 7019E77D2347296B008EA97A /* HelperExtensions.swift */, + ); + name = Extensions; + path = ../../Shared/Extensions; + sourceTree = ""; + }; 701A859821C0B656004C49DD = { isa = PBXGroup; children = ( @@ -98,9 +124,9 @@ 701A85A321C0B656004C49DD /* Swift-Example */ = { isa = PBXGroup; children = ( + 7019E77C2347296B008EA97A /* Extensions */, 701A85A421C0B656004C49DD /* AppDelegate.swift */, 701A85B721C0BC4E004C49DD /* Controllers */, - 701A85D621C0CCEE004C49DD /* Extensions */, 701A85B921C0BCBE004C49DD /* Resources */, 701A85BA21C0BCEA004C49DD /* Storyboards */, 701A85CE21C0C534004C49DD /* Supporting Files */, @@ -119,8 +145,8 @@ 701A85B921C0BCBE004C49DD /* Resources */ = { isa = PBXGroup; children = ( + 7019E75023472312008EA97A /* Fonts */, 701A85AB21C0B658004C49DD /* Assets.xcassets */, - 701A85BB21C0BFBD004C49DD /* Fonts */, ); path = Resources; sourceTree = ""; @@ -133,22 +159,6 @@ path = Storyboards; sourceTree = ""; }; - 701A85BB21C0BFBD004C49DD /* Fonts */ = { - isa = PBXGroup; - children = ( - 701A85C021C0BFDB004C49DD /* SF-UI-Text-Bold.otf */, - 701A85BD21C0BFDB004C49DD /* SF-UI-Text-Light.otf */, - 701A85BC21C0BFDB004C49DD /* SF-UI-Text-LightItalic.otf */, - 701A85C121C0BFDB004C49DD /* SF-UI-Text-Medium.otf */, - 701A85C321C0BFDB004C49DD /* SF-UI-Text-MediumItalic.otf */, - 701A85C221C0BFDB004C49DD /* SF-UI-Text-Regular.otf */, - 701A85BF21C0BFDB004C49DD /* SF-UI-Text-RegularItalic.otf */, - 701A85BE21C0BFDB004C49DD /* SF-UI-Text-Semibold.otf */, - 701A85C421C0BFDB004C49DD /* SF-UI-Text-SemiboldItalic.otf */, - ); - path = Fonts; - sourceTree = ""; - }; 701A85CE21C0C534004C49DD /* Supporting Files */ = { isa = PBXGroup; children = ( @@ -166,14 +176,6 @@ path = Base.lproj; sourceTree = ""; }; - 701A85D621C0CCEE004C49DD /* Extensions */ = { - isa = PBXGroup; - children = ( - 701A85D721C0CD18004C49DD /* HelperExtensions.swift */, - ); - path = Extensions; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -234,18 +236,18 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 701A85CD21C0BFDB004C49DD /* SF-UI-Text-SemiboldItalic.otf in Resources */, - 701A85CB21C0BFDB004C49DD /* SF-UI-Text-Regular.otf in Resources */, - 701A85C721C0BFDB004C49DD /* SF-UI-Text-Semibold.otf in Resources */, - 701A85C621C0BFDB004C49DD /* SF-UI-Text-Light.otf in Resources */, - 701A85C821C0BFDB004C49DD /* SF-UI-Text-RegularItalic.otf in Resources */, + 7019E76223472313008EA97A /* SF-UI-Text-Semibold.otf in Resources */, + 7019E75C23472313008EA97A /* SF-UI-Text-Bold.otf in Resources */, + 7019E75A23472313008EA97A /* SF-UI-Text-SemiboldItalic.otf in Resources */, + 7019E76023472313008EA97A /* SF-UI-Text-LightItalic.otf in Resources */, 701A85AC21C0B658004C49DD /* Assets.xcassets in Resources */, - 701A85C521C0BFDB004C49DD /* SF-UI-Text-LightItalic.otf in Resources */, + 7019E75B23472313008EA97A /* SF-UI-Text-RegularItalic.otf in Resources */, + 7019E75F23472313008EA97A /* SF-UI-Text-MediumItalic.otf in Resources */, 701A85D421C0C570004C49DD /* LaunchScreen.storyboard in Resources */, - 701A85CA21C0BFDB004C49DD /* SF-UI-Text-Medium.otf in Resources */, - 701A85C921C0BFDB004C49DD /* SF-UI-Text-Bold.otf in Resources */, + 7019E75D23472313008EA97A /* SF-UI-Text-Regular.otf in Resources */, + 7019E75E23472313008EA97A /* SF-UI-Text-Light.otf in Resources */, 701A85AA21C0B656004C49DD /* Main.storyboard in Resources */, - 701A85CC21C0BFDB004C49DD /* SF-UI-Text-MediumItalic.otf in Resources */, + 7019E76123472313008EA97A /* SF-UI-Text-Medium.otf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -299,7 +301,7 @@ buildActionMask = 2147483647; files = ( 701A85A721C0B656004C49DD /* RootViewController.swift in Sources */, - 701A85D821C0CD18004C49DD /* HelperExtensions.swift in Sources */, + 7019E77E2347296C008EA97A /* HelperExtensions.swift in Sources */, 701A85A521C0B656004C49DD /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Examples/Swift-Example/Swift-Example/Supporting Files/Info.plist b/Examples/Swift-Example/Swift-Example/Supporting Files/Info.plist index 4627f61..97488d9 100644 --- a/Examples/Swift-Example/Swift-Example/Supporting Files/Info.plist +++ b/Examples/Swift-Example/Swift-Example/Supporting Files/Info.plist @@ -40,9 +40,9 @@ shareAndRate appStoreUrl - https://itunes.apple.com/in/app/haptik-personal-assistant/id640450339 + iTunesItemIdentifier - 640450339 + shareText shareUrl