├── .gitignore ├── .swift-version ├── .swiftlint.yml ├── Assets ├── InAppPurchaseButton.gif ├── active.png ├── busy.png ├── downloading.png ├── inactive.png └── pgssoft-logo.png ├── InAppPurchaseButton tvOS ├── InAppPurchaseButton_tvOS.h └── Info.plist ├── InAppPurchaseButton.podspec ├── InAppPurchaseButton.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── InAppPurchaseButton iOS.xcscheme │ ├── InAppPurchaseButton tvOS.xcscheme │ └── InAppPurchaseButtonTests.xcscheme ├── InAppPurchaseButton.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── InAppPurchaseButtonTests ├── InAppPurchaseButtonTests.swift └── Info.plist ├── LICENSE ├── Package.swift ├── README.md ├── Sources ├── DefaultSettings.swift ├── InAppPurchaseButton.h ├── InAppPurchaseButton.swift ├── Info-iOS.plist ├── NSAttributedString+Extensions.swift ├── PassthroughView.swift ├── ProgressView.swift └── UIView+Extensions.swift ├── iOS Example ├── iOS Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── iOS Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── bluebutton.imageset │ │ ├── Contents.json │ │ ├── bluebutton.png │ │ ├── bluebutton@2x.png │ │ └── bluebutton@3x.png │ ├── pinkbutton.imageset │ │ ├── Contents.json │ │ ├── pinkbutton.png │ │ ├── pinkbutton@2x.png │ │ └── pinkbutton@3x.png │ └── progress-indicator.imageset │ │ ├── Contents.json │ │ ├── progress-indicator.png │ │ ├── progress-indicator@2x.png │ │ └── progress-indicator@3x.png │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift └── tvOS Example ├── tvOS Example.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── tvOS Example.xcscheme ├── tvOS Example ├── AppDelegate.swift ├── Assets.xcassets │ ├── App Icon & Top Shelf Image.brandassets │ │ ├── App Icon - App Store.imagestack │ │ │ ├── Back.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── Front.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ └── Middle.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ ├── App Icon.imagestack │ │ │ ├── Back.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── Front.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ └── Middle.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── Top Shelf Image Wide.imageset │ │ │ └── Contents.json │ │ └── Top Shelf Image.imageset │ │ │ └── Contents.json │ ├── Contents.json │ └── Launch Image.launchimage │ │ └── Contents.json ├── Base.lproj │ └── Main.storyboard ├── Info.plist └── ViewController.swift └── tvOS ExampleUITests ├── Info.plist └── tvOS_ExampleUITests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 5.0 2 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - line_length 3 | - type_name 4 | - file_length 5 | - type_body_length 6 | - function_body_length 7 | - empty_enum_arguments 8 | - fallthrough -------------------------------------------------------------------------------- /Assets/InAppPurchaseButton.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/Assets/InAppPurchaseButton.gif -------------------------------------------------------------------------------- /Assets/active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/Assets/active.png -------------------------------------------------------------------------------- /Assets/busy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/Assets/busy.png -------------------------------------------------------------------------------- /Assets/downloading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/Assets/downloading.png -------------------------------------------------------------------------------- /Assets/inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/Assets/inactive.png -------------------------------------------------------------------------------- /Assets/pgssoft-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/Assets/pgssoft-logo.png -------------------------------------------------------------------------------- /InAppPurchaseButton tvOS/InAppPurchaseButton_tvOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // InAppPurchaseButton_tvOS.h 3 | // InAppPurchaseButton tvOS 4 | // 5 | // Created by Luke Durrant on 21/2/19. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for InAppPurchaseButton_tvOS. 11 | FOUNDATION_EXPORT double InAppPurchaseButton_tvOSVersionNumber; 12 | 13 | //! Project version string for InAppPurchaseButton_tvOS. 14 | FOUNDATION_EXPORT const unsigned char InAppPurchaseButton_tvOSVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /InAppPurchaseButton tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /InAppPurchaseButton.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'InAppPurchaseButton' 3 | s.version = '1.1.1' 4 | s.license = 'MIT' 5 | s.summary = 'In-App Purchase Button written in Swift' 6 | s.homepage = 'https://github.com/PGSSoft/InAppPurchaseButton' 7 | s.authors = { 'Paweł Kania' => 'pkania@pgs-soft.com' } 8 | s.source = { :git => 'https://github.com/PGSSoft/InAppPurchaseButton.git', :tag => s.version } 9 | s.ios.deployment_target = '9.0' 10 | s.source_files = 'Sources/{*.swift}' 11 | end 12 | -------------------------------------------------------------------------------- /InAppPurchaseButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 48AF07CD1D65ED49009E9CBF /* InAppPurchaseButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48AF07CC1D65ED49009E9CBF /* InAppPurchaseButtonTests.swift */; }; 11 | 48AF07CF1D65ED49009E9CBF /* InAppPurchaseButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48B973341CDB44710015E695 /* InAppPurchaseButton.framework */; }; 12 | 48B973381CDB44710015E695 /* InAppPurchaseButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 48B973371CDB44710015E695 /* InAppPurchaseButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | 48B973401CDB4AA30015E695 /* InAppPurchaseButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48B9733F1CDB4AA30015E695 /* InAppPurchaseButton.swift */; }; 14 | 48BB9E631D645C5300AEBE0A /* InAppPurchaseButton.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 48BB9E601D645C5300AEBE0A /* InAppPurchaseButton.podspec */; }; 15 | 48BB9E641D645C5300AEBE0A /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 48BB9E611D645C5300AEBE0A /* LICENSE */; }; 16 | 48BB9E681D64815A00AEBE0A /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E671D64815A00AEBE0A /* UIView+Extensions.swift */; }; 17 | 48BB9E6A1D6481AF00AEBE0A /* PassthroughView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E691D6481AF00AEBE0A /* PassthroughView.swift */; }; 18 | 48BB9E6D1D648A9100AEBE0A /* ProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E6C1D648A9100AEBE0A /* ProgressView.swift */; }; 19 | 48BB9E6F1D648AE200AEBE0A /* DefaultSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E6E1D648AE200AEBE0A /* DefaultSettings.swift */; }; 20 | 48BB9E711D6492D000AEBE0A /* NSAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E701D6492D000AEBE0A /* NSAttributedString+Extensions.swift */; }; 21 | 9ACB2639221ED15B004C7CDB /* DefaultSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E6E1D648AE200AEBE0A /* DefaultSettings.swift */; }; 22 | 9ACB263A221ED15B004C7CDB /* PassthroughView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E691D6481AF00AEBE0A /* PassthroughView.swift */; }; 23 | 9ACB263B221ED15B004C7CDB /* ProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E6C1D648A9100AEBE0A /* ProgressView.swift */; }; 24 | 9ACB263C221ED165004C7CDB /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E671D64815A00AEBE0A /* UIView+Extensions.swift */; }; 25 | 9ACB263D221ED165004C7CDB /* NSAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48BB9E701D6492D000AEBE0A /* NSAttributedString+Extensions.swift */; }; 26 | 9ACB263E221ED16A004C7CDB /* InAppPurchaseButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48B9733F1CDB4AA30015E695 /* InAppPurchaseButton.swift */; }; 27 | 9ACB2647221ED317004C7CDB /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9ACB2646221ED317004C7CDB /* QuartzCore.framework */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | 48AF07D01D65ED49009E9CBF /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 48B973281CDB43930015E695 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 48B973331CDB44710015E695; 36 | remoteInfo = "InAppPurchaseButton iOS"; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 48AF07CA1D65ED49009E9CBF /* InAppPurchaseButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InAppPurchaseButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 48AF07CC1D65ED49009E9CBF /* InAppPurchaseButtonTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPurchaseButtonTests.swift; sourceTree = ""; }; 43 | 48AF07CE1D65ED49009E9CBF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 48B973341CDB44710015E695 /* InAppPurchaseButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = InAppPurchaseButton.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 48B973371CDB44710015E695 /* InAppPurchaseButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InAppPurchaseButton.h; sourceTree = ""; }; 46 | 48B973391CDB44710015E695 /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; }; 47 | 48B9733F1CDB4AA30015E695 /* InAppPurchaseButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InAppPurchaseButton.swift; sourceTree = ""; }; 48 | 48BB9E601D645C5300AEBE0A /* InAppPurchaseButton.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = InAppPurchaseButton.podspec; sourceTree = ""; }; 49 | 48BB9E611D645C5300AEBE0A /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 50 | 48BB9E621D645C5300AEBE0A /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 51 | 48BB9E671D64815A00AEBE0A /* UIView+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Extensions.swift"; sourceTree = ""; }; 52 | 48BB9E691D6481AF00AEBE0A /* PassthroughView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassthroughView.swift; sourceTree = ""; }; 53 | 48BB9E6C1D648A9100AEBE0A /* ProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressView.swift; sourceTree = ""; }; 54 | 48BB9E6E1D648AE200AEBE0A /* DefaultSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultSettings.swift; sourceTree = ""; }; 55 | 48BB9E701D6492D000AEBE0A /* NSAttributedString+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+Extensions.swift"; sourceTree = ""; }; 56 | 9ACB2631221ED0C7004C7CDB /* InAppPurchaseButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = InAppPurchaseButton.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 9ACB2646221ED317004C7CDB /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.1.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 48AF07C71D65ED49009E9CBF /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 48AF07CF1D65ED49009E9CBF /* InAppPurchaseButton.framework in Frameworks */, 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | 48B973301CDB44710015E695 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | 9ACB262E221ED0C7004C7CDB /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | 9ACB2647221ED317004C7CDB /* QuartzCore.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | 48AF07CB1D65ED49009E9CBF /* InAppPurchaseButtonTests */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 48AF07CC1D65ED49009E9CBF /* InAppPurchaseButtonTests.swift */, 91 | 48AF07CE1D65ED49009E9CBF /* Info.plist */, 92 | ); 93 | path = InAppPurchaseButtonTests; 94 | sourceTree = ""; 95 | }; 96 | 48B973271CDB43930015E695 = { 97 | isa = PBXGroup; 98 | children = ( 99 | 48B9733D1CDB452F0015E695 /* Sources */, 100 | 48AF07CB1D65ED49009E9CBF /* InAppPurchaseButtonTests */, 101 | 48B973351CDB44710015E695 /* Products */, 102 | 9ACB2645221ED317004C7CDB /* Frameworks */, 103 | ); 104 | sourceTree = ""; 105 | }; 106 | 48B973351CDB44710015E695 /* Products */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 48B973341CDB44710015E695 /* InAppPurchaseButton.framework */, 110 | 48AF07CA1D65ED49009E9CBF /* InAppPurchaseButtonTests.xctest */, 111 | 9ACB2631221ED0C7004C7CDB /* InAppPurchaseButton.framework */, 112 | ); 113 | name = Products; 114 | sourceTree = ""; 115 | }; 116 | 48B9733D1CDB452F0015E695 /* Sources */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 48B9733F1CDB4AA30015E695 /* InAppPurchaseButton.swift */, 120 | 48BB9E541D645A9F00AEBE0A /* Core */, 121 | 48BB9E551D645AA500AEBE0A /* Foundation Extensions */, 122 | 48BB9E561D645AAD00AEBE0A /* Metadata */, 123 | 48BB9E571D645AB500AEBE0A /* Supporting Files */, 124 | ); 125 | path = Sources; 126 | sourceTree = ""; 127 | }; 128 | 48BB9E541D645A9F00AEBE0A /* Core */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 48BB9E6E1D648AE200AEBE0A /* DefaultSettings.swift */, 132 | 48BB9E691D6481AF00AEBE0A /* PassthroughView.swift */, 133 | 48BB9E6C1D648A9100AEBE0A /* ProgressView.swift */, 134 | ); 135 | name = Core; 136 | sourceTree = ""; 137 | }; 138 | 48BB9E551D645AA500AEBE0A /* Foundation Extensions */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 48BB9E671D64815A00AEBE0A /* UIView+Extensions.swift */, 142 | 48BB9E701D6492D000AEBE0A /* NSAttributedString+Extensions.swift */, 143 | ); 144 | name = "Foundation Extensions"; 145 | sourceTree = ""; 146 | }; 147 | 48BB9E561D645AAD00AEBE0A /* Metadata */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 48BB9E601D645C5300AEBE0A /* InAppPurchaseButton.podspec */, 151 | 48BB9E611D645C5300AEBE0A /* LICENSE */, 152 | 48BB9E621D645C5300AEBE0A /* README.md */, 153 | ); 154 | name = Metadata; 155 | path = ..; 156 | sourceTree = ""; 157 | }; 158 | 48BB9E571D645AB500AEBE0A /* Supporting Files */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 48B973371CDB44710015E695 /* InAppPurchaseButton.h */, 162 | 48B973391CDB44710015E695 /* Info-iOS.plist */, 163 | ); 164 | name = "Supporting Files"; 165 | sourceTree = ""; 166 | }; 167 | 9ACB2645221ED317004C7CDB /* Frameworks */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 9ACB2646221ED317004C7CDB /* QuartzCore.framework */, 171 | ); 172 | name = Frameworks; 173 | sourceTree = ""; 174 | }; 175 | /* End PBXGroup section */ 176 | 177 | /* Begin PBXHeadersBuildPhase section */ 178 | 48B973311CDB44710015E695 /* Headers */ = { 179 | isa = PBXHeadersBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 48B973381CDB44710015E695 /* InAppPurchaseButton.h in Headers */, 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | 9ACB262C221ED0C7004C7CDB /* Headers */ = { 187 | isa = PBXHeadersBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | runOnlyForDeploymentPostprocessing = 0; 192 | }; 193 | /* End PBXHeadersBuildPhase section */ 194 | 195 | /* Begin PBXNativeTarget section */ 196 | 48AF07C91D65ED49009E9CBF /* InAppPurchaseButtonTests */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = 48AF07D41D65ED49009E9CBF /* Build configuration list for PBXNativeTarget "InAppPurchaseButtonTests" */; 199 | buildPhases = ( 200 | 48AF07C61D65ED49009E9CBF /* Sources */, 201 | 48AF07C71D65ED49009E9CBF /* Frameworks */, 202 | 48AF07C81D65ED49009E9CBF /* Resources */, 203 | ); 204 | buildRules = ( 205 | ); 206 | dependencies = ( 207 | 48AF07D11D65ED49009E9CBF /* PBXTargetDependency */, 208 | ); 209 | name = InAppPurchaseButtonTests; 210 | productName = InAppPurchaseButtonTests; 211 | productReference = 48AF07CA1D65ED49009E9CBF /* InAppPurchaseButtonTests.xctest */; 212 | productType = "com.apple.product-type.bundle.unit-test"; 213 | }; 214 | 48B973331CDB44710015E695 /* InAppPurchaseButton iOS */ = { 215 | isa = PBXNativeTarget; 216 | buildConfigurationList = 48B9733A1CDB44710015E695 /* Build configuration list for PBXNativeTarget "InAppPurchaseButton iOS" */; 217 | buildPhases = ( 218 | 48B9732F1CDB44710015E695 /* Sources */, 219 | 48B973301CDB44710015E695 /* Frameworks */, 220 | 48B973311CDB44710015E695 /* Headers */, 221 | 48B973321CDB44710015E695 /* Resources */, 222 | 4889396D1D1BFF8800EADCEE /* Swiftlint */, 223 | ); 224 | buildRules = ( 225 | ); 226 | dependencies = ( 227 | ); 228 | name = "InAppPurchaseButton iOS"; 229 | productName = "InAppPurchaseButton iOS"; 230 | productReference = 48B973341CDB44710015E695 /* InAppPurchaseButton.framework */; 231 | productType = "com.apple.product-type.framework"; 232 | }; 233 | 9ACB2630221ED0C7004C7CDB /* InAppPurchaseButton tvOS */ = { 234 | isa = PBXNativeTarget; 235 | buildConfigurationList = 9ACB2638221ED0C7004C7CDB /* Build configuration list for PBXNativeTarget "InAppPurchaseButton tvOS" */; 236 | buildPhases = ( 237 | 9ACB262C221ED0C7004C7CDB /* Headers */, 238 | 9ACB262D221ED0C7004C7CDB /* Sources */, 239 | 9ACB262E221ED0C7004C7CDB /* Frameworks */, 240 | 9ACB262F221ED0C7004C7CDB /* Resources */, 241 | ); 242 | buildRules = ( 243 | ); 244 | dependencies = ( 245 | ); 246 | name = "InAppPurchaseButton tvOS"; 247 | productName = "InAppPurchaseButton tvOS"; 248 | productReference = 9ACB2631221ED0C7004C7CDB /* InAppPurchaseButton.framework */; 249 | productType = "com.apple.product-type.framework"; 250 | }; 251 | /* End PBXNativeTarget section */ 252 | 253 | /* Begin PBXProject section */ 254 | 48B973281CDB43930015E695 /* Project object */ = { 255 | isa = PBXProject; 256 | attributes = { 257 | LastSwiftUpdateCheck = 0730; 258 | LastUpgradeCheck = 1200; 259 | TargetAttributes = { 260 | 48AF07C91D65ED49009E9CBF = { 261 | CreatedOnToolsVersion = 7.3.1; 262 | }; 263 | 48B973331CDB44710015E695 = { 264 | CreatedOnToolsVersion = 7.3.1; 265 | LastSwiftMigration = 1020; 266 | }; 267 | 9ACB2630221ED0C7004C7CDB = { 268 | CreatedOnToolsVersion = 10.1; 269 | DevelopmentTeam = 2A46D7V85T; 270 | ProvisioningStyle = Automatic; 271 | }; 272 | }; 273 | }; 274 | buildConfigurationList = 48B9732B1CDB43930015E695 /* Build configuration list for PBXProject "InAppPurchaseButton" */; 275 | compatibilityVersion = "Xcode 3.2"; 276 | developmentRegion = en; 277 | hasScannedForEncodings = 0; 278 | knownRegions = ( 279 | Base, 280 | en, 281 | ); 282 | mainGroup = 48B973271CDB43930015E695; 283 | productRefGroup = 48B973351CDB44710015E695 /* Products */; 284 | projectDirPath = ""; 285 | projectRoot = ""; 286 | targets = ( 287 | 48B973331CDB44710015E695 /* InAppPurchaseButton iOS */, 288 | 9ACB2630221ED0C7004C7CDB /* InAppPurchaseButton tvOS */, 289 | 48AF07C91D65ED49009E9CBF /* InAppPurchaseButtonTests */, 290 | ); 291 | }; 292 | /* End PBXProject section */ 293 | 294 | /* Begin PBXResourcesBuildPhase section */ 295 | 48AF07C81D65ED49009E9CBF /* Resources */ = { 296 | isa = PBXResourcesBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | 48B973321CDB44710015E695 /* Resources */ = { 303 | isa = PBXResourcesBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | 48BB9E641D645C5300AEBE0A /* LICENSE in Resources */, 307 | 48BB9E631D645C5300AEBE0A /* InAppPurchaseButton.podspec in Resources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | 9ACB262F221ED0C7004C7CDB /* Resources */ = { 312 | isa = PBXResourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | ); 316 | runOnlyForDeploymentPostprocessing = 0; 317 | }; 318 | /* End PBXResourcesBuildPhase section */ 319 | 320 | /* Begin PBXShellScriptBuildPhase section */ 321 | 4889396D1D1BFF8800EADCEE /* Swiftlint */ = { 322 | isa = PBXShellScriptBuildPhase; 323 | buildActionMask = 2147483647; 324 | files = ( 325 | ); 326 | inputPaths = ( 327 | ); 328 | name = Swiftlint; 329 | outputPaths = ( 330 | ); 331 | runOnlyForDeploymentPostprocessing = 0; 332 | shellPath = /bin/sh; 333 | shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; 334 | }; 335 | /* End PBXShellScriptBuildPhase section */ 336 | 337 | /* Begin PBXSourcesBuildPhase section */ 338 | 48AF07C61D65ED49009E9CBF /* Sources */ = { 339 | isa = PBXSourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | 48AF07CD1D65ED49009E9CBF /* InAppPurchaseButtonTests.swift in Sources */, 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | 48B9732F1CDB44710015E695 /* Sources */ = { 347 | isa = PBXSourcesBuildPhase; 348 | buildActionMask = 2147483647; 349 | files = ( 350 | 48BB9E6F1D648AE200AEBE0A /* DefaultSettings.swift in Sources */, 351 | 48BB9E711D6492D000AEBE0A /* NSAttributedString+Extensions.swift in Sources */, 352 | 48BB9E681D64815A00AEBE0A /* UIView+Extensions.swift in Sources */, 353 | 48BB9E6D1D648A9100AEBE0A /* ProgressView.swift in Sources */, 354 | 48BB9E6A1D6481AF00AEBE0A /* PassthroughView.swift in Sources */, 355 | 48B973401CDB4AA30015E695 /* InAppPurchaseButton.swift in Sources */, 356 | ); 357 | runOnlyForDeploymentPostprocessing = 0; 358 | }; 359 | 9ACB262D221ED0C7004C7CDB /* Sources */ = { 360 | isa = PBXSourcesBuildPhase; 361 | buildActionMask = 2147483647; 362 | files = ( 363 | 9ACB2639221ED15B004C7CDB /* DefaultSettings.swift in Sources */, 364 | 9ACB263A221ED15B004C7CDB /* PassthroughView.swift in Sources */, 365 | 9ACB263C221ED165004C7CDB /* UIView+Extensions.swift in Sources */, 366 | 9ACB263E221ED16A004C7CDB /* InAppPurchaseButton.swift in Sources */, 367 | 9ACB263D221ED165004C7CDB /* NSAttributedString+Extensions.swift in Sources */, 368 | 9ACB263B221ED15B004C7CDB /* ProgressView.swift in Sources */, 369 | ); 370 | runOnlyForDeploymentPostprocessing = 0; 371 | }; 372 | /* End PBXSourcesBuildPhase section */ 373 | 374 | /* Begin PBXTargetDependency section */ 375 | 48AF07D11D65ED49009E9CBF /* PBXTargetDependency */ = { 376 | isa = PBXTargetDependency; 377 | target = 48B973331CDB44710015E695 /* InAppPurchaseButton iOS */; 378 | targetProxy = 48AF07D01D65ED49009E9CBF /* PBXContainerItemProxy */; 379 | }; 380 | /* End PBXTargetDependency section */ 381 | 382 | /* Begin XCBuildConfiguration section */ 383 | 48AF07D21D65ED49009E9CBF /* Debug */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ALWAYS_SEARCH_USER_PATHS = NO; 387 | CLANG_ANALYZER_NONNULL = YES; 388 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 389 | CLANG_CXX_LIBRARY = "libc++"; 390 | CLANG_ENABLE_MODULES = YES; 391 | CLANG_ENABLE_OBJC_ARC = YES; 392 | CLANG_WARN_BOOL_CONVERSION = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 395 | CLANG_WARN_EMPTY_BODY = YES; 396 | CLANG_WARN_ENUM_CONVERSION = YES; 397 | CLANG_WARN_INT_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_UNREACHABLE_CODE = YES; 400 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 401 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 402 | COPY_PHASE_STRIP = NO; 403 | DEBUG_INFORMATION_FORMAT = dwarf; 404 | ENABLE_STRICT_OBJC_MSGSEND = YES; 405 | ENABLE_TESTABILITY = YES; 406 | GCC_C_LANGUAGE_STANDARD = gnu99; 407 | GCC_DYNAMIC_NO_PIC = NO; 408 | GCC_NO_COMMON_BLOCKS = YES; 409 | GCC_OPTIMIZATION_LEVEL = 0; 410 | GCC_PREPROCESSOR_DEFINITIONS = ( 411 | "DEBUG=1", 412 | "$(inherited)", 413 | ); 414 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 415 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 416 | GCC_WARN_UNDECLARED_SELECTOR = YES; 417 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 418 | GCC_WARN_UNUSED_FUNCTION = YES; 419 | GCC_WARN_UNUSED_VARIABLE = YES; 420 | INFOPLIST_FILE = InAppPurchaseButtonTests/Info.plist; 421 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 422 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 423 | MTL_ENABLE_DEBUG_INFO = YES; 424 | ONLY_ACTIVE_ARCH = YES; 425 | PRODUCT_BUNDLE_IDENTIFIER = com.InAppPurchaseButtonTests; 426 | PRODUCT_NAME = "$(TARGET_NAME)"; 427 | SDKROOT = iphoneos; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | SWIFT_VERSION = 5.0; 430 | }; 431 | name = Debug; 432 | }; 433 | 48AF07D31D65ED49009E9CBF /* Release */ = { 434 | isa = XCBuildConfiguration; 435 | buildSettings = { 436 | ALWAYS_SEARCH_USER_PATHS = NO; 437 | CLANG_ANALYZER_NONNULL = YES; 438 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 439 | CLANG_CXX_LIBRARY = "libc++"; 440 | CLANG_ENABLE_MODULES = YES; 441 | CLANG_ENABLE_OBJC_ARC = YES; 442 | CLANG_WARN_BOOL_CONVERSION = YES; 443 | CLANG_WARN_CONSTANT_CONVERSION = YES; 444 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 445 | CLANG_WARN_EMPTY_BODY = YES; 446 | CLANG_WARN_ENUM_CONVERSION = YES; 447 | CLANG_WARN_INT_CONVERSION = YES; 448 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 449 | CLANG_WARN_UNREACHABLE_CODE = YES; 450 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 451 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 452 | COPY_PHASE_STRIP = NO; 453 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 454 | ENABLE_NS_ASSERTIONS = NO; 455 | ENABLE_STRICT_OBJC_MSGSEND = YES; 456 | GCC_C_LANGUAGE_STANDARD = gnu99; 457 | GCC_NO_COMMON_BLOCKS = YES; 458 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 459 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 460 | GCC_WARN_UNDECLARED_SELECTOR = YES; 461 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 462 | GCC_WARN_UNUSED_FUNCTION = YES; 463 | GCC_WARN_UNUSED_VARIABLE = YES; 464 | INFOPLIST_FILE = InAppPurchaseButtonTests/Info.plist; 465 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 466 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 467 | MTL_ENABLE_DEBUG_INFO = NO; 468 | PRODUCT_BUNDLE_IDENTIFIER = com.InAppPurchaseButtonTests; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | SDKROOT = iphoneos; 471 | SWIFT_VERSION = 5.0; 472 | VALIDATE_PRODUCT = YES; 473 | }; 474 | name = Release; 475 | }; 476 | 48B9732C1CDB43930015E695 /* Debug */ = { 477 | isa = XCBuildConfiguration; 478 | buildSettings = { 479 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 480 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 481 | CLANG_WARN_BOOL_CONVERSION = YES; 482 | CLANG_WARN_COMMA = YES; 483 | CLANG_WARN_CONSTANT_CONVERSION = YES; 484 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 485 | CLANG_WARN_EMPTY_BODY = YES; 486 | CLANG_WARN_ENUM_CONVERSION = YES; 487 | CLANG_WARN_INFINITE_RECURSION = YES; 488 | CLANG_WARN_INT_CONVERSION = YES; 489 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 490 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 491 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 492 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 493 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 494 | CLANG_WARN_STRICT_PROTOTYPES = YES; 495 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 496 | CLANG_WARN_UNREACHABLE_CODE = YES; 497 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 498 | ENABLE_STRICT_OBJC_MSGSEND = YES; 499 | ENABLE_TESTABILITY = YES; 500 | GCC_NO_COMMON_BLOCKS = YES; 501 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 502 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 503 | GCC_WARN_UNDECLARED_SELECTOR = YES; 504 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 505 | GCC_WARN_UNUSED_FUNCTION = YES; 506 | GCC_WARN_UNUSED_VARIABLE = YES; 507 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 508 | ONLY_ACTIVE_ARCH = YES; 509 | PRODUCT_BUNDLE_IDENTIFIER = com.inapppurchasebutton; 510 | PRODUCT_NAME = InAppPurchaseButton; 511 | }; 512 | name = Debug; 513 | }; 514 | 48B9732D1CDB43930015E695 /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 518 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 519 | CLANG_WARN_BOOL_CONVERSION = YES; 520 | CLANG_WARN_COMMA = YES; 521 | CLANG_WARN_CONSTANT_CONVERSION = YES; 522 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 523 | CLANG_WARN_EMPTY_BODY = YES; 524 | CLANG_WARN_ENUM_CONVERSION = YES; 525 | CLANG_WARN_INFINITE_RECURSION = YES; 526 | CLANG_WARN_INT_CONVERSION = YES; 527 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 528 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 529 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 530 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 531 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 532 | CLANG_WARN_STRICT_PROTOTYPES = YES; 533 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 534 | CLANG_WARN_UNREACHABLE_CODE = YES; 535 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 536 | ENABLE_STRICT_OBJC_MSGSEND = YES; 537 | GCC_NO_COMMON_BLOCKS = YES; 538 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 539 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 540 | GCC_WARN_UNDECLARED_SELECTOR = YES; 541 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 542 | GCC_WARN_UNUSED_FUNCTION = YES; 543 | GCC_WARN_UNUSED_VARIABLE = YES; 544 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 545 | PRODUCT_BUNDLE_IDENTIFIER = com.inapppurchasebutton; 546 | PRODUCT_NAME = InAppPurchaseButton; 547 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 548 | }; 549 | name = Release; 550 | }; 551 | 48B9733B1CDB44710015E695 /* Debug */ = { 552 | isa = XCBuildConfiguration; 553 | buildSettings = { 554 | ALWAYS_SEARCH_USER_PATHS = NO; 555 | APPLICATION_EXTENSION_API_ONLY = YES; 556 | CLANG_ANALYZER_NONNULL = YES; 557 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 558 | CLANG_CXX_LIBRARY = "libc++"; 559 | CLANG_ENABLE_MODULES = YES; 560 | CLANG_ENABLE_OBJC_ARC = YES; 561 | CLANG_WARN_BOOL_CONVERSION = YES; 562 | CLANG_WARN_CONSTANT_CONVERSION = YES; 563 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 564 | CLANG_WARN_EMPTY_BODY = YES; 565 | CLANG_WARN_ENUM_CONVERSION = YES; 566 | CLANG_WARN_INT_CONVERSION = YES; 567 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 568 | CLANG_WARN_UNREACHABLE_CODE = YES; 569 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 570 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 571 | COPY_PHASE_STRIP = NO; 572 | CURRENT_PROJECT_VERSION = 1; 573 | DEBUG_INFORMATION_FORMAT = dwarf; 574 | DEFINES_MODULE = YES; 575 | DYLIB_COMPATIBILITY_VERSION = 1; 576 | DYLIB_CURRENT_VERSION = 1; 577 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 578 | ENABLE_STRICT_OBJC_MSGSEND = YES; 579 | ENABLE_TESTABILITY = YES; 580 | GCC_C_LANGUAGE_STANDARD = gnu99; 581 | GCC_DYNAMIC_NO_PIC = NO; 582 | GCC_NO_COMMON_BLOCKS = YES; 583 | GCC_OPTIMIZATION_LEVEL = 0; 584 | GCC_PREPROCESSOR_DEFINITIONS = ( 585 | "DEBUG=1", 586 | "$(inherited)", 587 | ); 588 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 589 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 590 | GCC_WARN_UNDECLARED_SELECTOR = YES; 591 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 592 | GCC_WARN_UNUSED_FUNCTION = YES; 593 | GCC_WARN_UNUSED_VARIABLE = YES; 594 | INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-iOS.plist"; 595 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 596 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 597 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 598 | MARKETING_VERSION = 1.1.0; 599 | MTL_ENABLE_DEBUG_INFO = YES; 600 | ONLY_ACTIVE_ARCH = YES; 601 | PRODUCT_NAME = InAppPurchaseButton; 602 | SDKROOT = iphoneos; 603 | SKIP_INSTALL = YES; 604 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 605 | SWIFT_VERSION = 5.0; 606 | TARGETED_DEVICE_FAMILY = "1,2"; 607 | VERSIONING_SYSTEM = "apple-generic"; 608 | VERSION_INFO_PREFIX = ""; 609 | }; 610 | name = Debug; 611 | }; 612 | 48B9733C1CDB44710015E695 /* Release */ = { 613 | isa = XCBuildConfiguration; 614 | buildSettings = { 615 | ALWAYS_SEARCH_USER_PATHS = NO; 616 | APPLICATION_EXTENSION_API_ONLY = YES; 617 | CLANG_ANALYZER_NONNULL = YES; 618 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 619 | CLANG_CXX_LIBRARY = "libc++"; 620 | CLANG_ENABLE_MODULES = YES; 621 | CLANG_ENABLE_OBJC_ARC = YES; 622 | CLANG_WARN_BOOL_CONVERSION = YES; 623 | CLANG_WARN_CONSTANT_CONVERSION = YES; 624 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 625 | CLANG_WARN_EMPTY_BODY = YES; 626 | CLANG_WARN_ENUM_CONVERSION = YES; 627 | CLANG_WARN_INT_CONVERSION = YES; 628 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 629 | CLANG_WARN_UNREACHABLE_CODE = YES; 630 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 631 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 632 | COPY_PHASE_STRIP = NO; 633 | CURRENT_PROJECT_VERSION = 1; 634 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 635 | DEFINES_MODULE = YES; 636 | DYLIB_COMPATIBILITY_VERSION = 1; 637 | DYLIB_CURRENT_VERSION = 1; 638 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 639 | ENABLE_NS_ASSERTIONS = NO; 640 | ENABLE_STRICT_OBJC_MSGSEND = YES; 641 | GCC_C_LANGUAGE_STANDARD = gnu99; 642 | GCC_NO_COMMON_BLOCKS = YES; 643 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 644 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 645 | GCC_WARN_UNDECLARED_SELECTOR = YES; 646 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 647 | GCC_WARN_UNUSED_FUNCTION = YES; 648 | GCC_WARN_UNUSED_VARIABLE = YES; 649 | INFOPLIST_FILE = "$(SRCROOT)/Sources/Info-iOS.plist"; 650 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 651 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 652 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 653 | MARKETING_VERSION = 1.1.0; 654 | MTL_ENABLE_DEBUG_INFO = NO; 655 | PRODUCT_NAME = InAppPurchaseButton; 656 | SDKROOT = iphoneos; 657 | SKIP_INSTALL = YES; 658 | SWIFT_VERSION = 5.0; 659 | TARGETED_DEVICE_FAMILY = "1,2"; 660 | VALIDATE_PRODUCT = YES; 661 | VERSIONING_SYSTEM = "apple-generic"; 662 | VERSION_INFO_PREFIX = ""; 663 | }; 664 | name = Release; 665 | }; 666 | 9ACB2636221ED0C7004C7CDB /* Debug */ = { 667 | isa = XCBuildConfiguration; 668 | buildSettings = { 669 | ALWAYS_SEARCH_USER_PATHS = NO; 670 | CLANG_ANALYZER_NONNULL = YES; 671 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 672 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 673 | CLANG_CXX_LIBRARY = "libc++"; 674 | CLANG_ENABLE_MODULES = YES; 675 | CLANG_ENABLE_OBJC_ARC = YES; 676 | CLANG_ENABLE_OBJC_WEAK = YES; 677 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 678 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 679 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 680 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 681 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 682 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 683 | CODE_SIGN_IDENTITY = ""; 684 | CODE_SIGN_STYLE = Automatic; 685 | COPY_PHASE_STRIP = NO; 686 | CURRENT_PROJECT_VERSION = 1; 687 | DEBUG_INFORMATION_FORMAT = dwarf; 688 | DEFINES_MODULE = YES; 689 | DEVELOPMENT_TEAM = 2A46D7V85T; 690 | DYLIB_COMPATIBILITY_VERSION = 1; 691 | DYLIB_CURRENT_VERSION = 1; 692 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 693 | GCC_C_LANGUAGE_STANDARD = gnu11; 694 | GCC_DYNAMIC_NO_PIC = NO; 695 | GCC_OPTIMIZATION_LEVEL = 0; 696 | GCC_PREPROCESSOR_DEFINITIONS = ( 697 | "DEBUG=1", 698 | "$(inherited)", 699 | ); 700 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 701 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 702 | INFOPLIST_FILE = "InAppPurchaseButton tvOS/Info.plist"; 703 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 704 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 705 | MARKETING_VERSION = 1.1.0; 706 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 707 | MTL_FAST_MATH = YES; 708 | PRODUCT_NAME = InAppPurchaseButton; 709 | SDKROOT = appletvos; 710 | SKIP_INSTALL = YES; 711 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 712 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 713 | SWIFT_VERSION = 5.0; 714 | TARGETED_DEVICE_FAMILY = 3; 715 | TVOS_DEPLOYMENT_TARGET = 9.0; 716 | VERSIONING_SYSTEM = "apple-generic"; 717 | VERSION_INFO_PREFIX = ""; 718 | }; 719 | name = Debug; 720 | }; 721 | 9ACB2637221ED0C7004C7CDB /* Release */ = { 722 | isa = XCBuildConfiguration; 723 | buildSettings = { 724 | ALWAYS_SEARCH_USER_PATHS = NO; 725 | CLANG_ANALYZER_NONNULL = YES; 726 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 727 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 728 | CLANG_CXX_LIBRARY = "libc++"; 729 | CLANG_ENABLE_MODULES = YES; 730 | CLANG_ENABLE_OBJC_ARC = YES; 731 | CLANG_ENABLE_OBJC_WEAK = YES; 732 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 733 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 734 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 735 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 736 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 737 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 738 | CODE_SIGN_IDENTITY = ""; 739 | CODE_SIGN_STYLE = Automatic; 740 | COPY_PHASE_STRIP = NO; 741 | CURRENT_PROJECT_VERSION = 1; 742 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 743 | DEFINES_MODULE = YES; 744 | DEVELOPMENT_TEAM = 2A46D7V85T; 745 | DYLIB_COMPATIBILITY_VERSION = 1; 746 | DYLIB_CURRENT_VERSION = 1; 747 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 748 | ENABLE_NS_ASSERTIONS = NO; 749 | GCC_C_LANGUAGE_STANDARD = gnu11; 750 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 751 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 752 | INFOPLIST_FILE = "InAppPurchaseButton tvOS/Info.plist"; 753 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 754 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 755 | MARKETING_VERSION = 1.1.0; 756 | MTL_ENABLE_DEBUG_INFO = NO; 757 | MTL_FAST_MATH = YES; 758 | PRODUCT_NAME = InAppPurchaseButton; 759 | SDKROOT = appletvos; 760 | SKIP_INSTALL = YES; 761 | SWIFT_VERSION = 5.0; 762 | TARGETED_DEVICE_FAMILY = 3; 763 | TVOS_DEPLOYMENT_TARGET = 9.0; 764 | VALIDATE_PRODUCT = YES; 765 | VERSIONING_SYSTEM = "apple-generic"; 766 | VERSION_INFO_PREFIX = ""; 767 | }; 768 | name = Release; 769 | }; 770 | /* End XCBuildConfiguration section */ 771 | 772 | /* Begin XCConfigurationList section */ 773 | 48AF07D41D65ED49009E9CBF /* Build configuration list for PBXNativeTarget "InAppPurchaseButtonTests" */ = { 774 | isa = XCConfigurationList; 775 | buildConfigurations = ( 776 | 48AF07D21D65ED49009E9CBF /* Debug */, 777 | 48AF07D31D65ED49009E9CBF /* Release */, 778 | ); 779 | defaultConfigurationIsVisible = 0; 780 | defaultConfigurationName = Release; 781 | }; 782 | 48B9732B1CDB43930015E695 /* Build configuration list for PBXProject "InAppPurchaseButton" */ = { 783 | isa = XCConfigurationList; 784 | buildConfigurations = ( 785 | 48B9732C1CDB43930015E695 /* Debug */, 786 | 48B9732D1CDB43930015E695 /* Release */, 787 | ); 788 | defaultConfigurationIsVisible = 0; 789 | defaultConfigurationName = Release; 790 | }; 791 | 48B9733A1CDB44710015E695 /* Build configuration list for PBXNativeTarget "InAppPurchaseButton iOS" */ = { 792 | isa = XCConfigurationList; 793 | buildConfigurations = ( 794 | 48B9733B1CDB44710015E695 /* Debug */, 795 | 48B9733C1CDB44710015E695 /* Release */, 796 | ); 797 | defaultConfigurationIsVisible = 0; 798 | defaultConfigurationName = Release; 799 | }; 800 | 9ACB2638221ED0C7004C7CDB /* Build configuration list for PBXNativeTarget "InAppPurchaseButton tvOS" */ = { 801 | isa = XCConfigurationList; 802 | buildConfigurations = ( 803 | 9ACB2636221ED0C7004C7CDB /* Debug */, 804 | 9ACB2637221ED0C7004C7CDB /* Release */, 805 | ); 806 | defaultConfigurationIsVisible = 0; 807 | defaultConfigurationName = Release; 808 | }; 809 | /* End XCConfigurationList section */ 810 | }; 811 | rootObject = 48B973281CDB43930015E695 /* Project object */; 812 | } 813 | -------------------------------------------------------------------------------- /InAppPurchaseButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /InAppPurchaseButton.xcodeproj/xcshareddata/xcschemes/InAppPurchaseButton iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /InAppPurchaseButton.xcodeproj/xcshareddata/xcschemes/InAppPurchaseButton tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /InAppPurchaseButton.xcodeproj/xcshareddata/xcschemes/InAppPurchaseButtonTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 26 | 27 | 37 | 38 | 44 | 45 | 47 | 48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /InAppPurchaseButton.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /InAppPurchaseButton.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /InAppPurchaseButtonTests/InAppPurchaseButtonTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InAppPurchaseButtonTests.swift 3 | // InAppPurchaseButtonTests 4 | // 5 | // Created by Paweł Kania on 18/08/16. 6 | // 7 | // 8 | 9 | import XCTest 10 | @testable import InAppPurchaseButton 11 | 12 | class InAppPurchaseButtonTests: XCTestCase { 13 | 14 | func testInAppPurchaseButtonStates() { 15 | let inAppPurchaseButton = InAppPurchaseButton() 16 | 17 | XCTAssertTrue(inAppPurchaseButton.buttonState == .regular(animate: true, intermediateState: .inactive)) 18 | 19 | inAppPurchaseButton.buttonState = .busy(animate: true) 20 | XCTAssertTrue(inAppPurchaseButton.buttonState == .busy(animate: true)) 21 | 22 | inAppPurchaseButton.buttonState = .downloading(progress: 0.25) 23 | XCTAssertTrue(inAppPurchaseButton.buttonState == .downloading(progress: 0.25)) 24 | 25 | inAppPurchaseButton.buttonState = .downloading(progress: 0.5) 26 | XCTAssertTrue(inAppPurchaseButton.buttonState == .downloading(progress: 0.5)) 27 | 28 | inAppPurchaseButton.buttonState = .downloading(progress: 0.75) 29 | XCTAssertTrue(inAppPurchaseButton.buttonState == .downloading(progress: 0.75)) 30 | 31 | inAppPurchaseButton.buttonState = .downloading(progress: 1) 32 | XCTAssertTrue(inAppPurchaseButton.buttonState == .downloading(progress: 1)) 33 | 34 | inAppPurchaseButton.buttonState = .regular(animate: true, intermediateState: .active) 35 | XCTAssertTrue(inAppPurchaseButton.buttonState == .regular(animate: true, intermediateState: .active)) 36 | 37 | inAppPurchaseButton.buttonState = .regular(animate: true, intermediateState: .inactive) 38 | XCTAssertTrue(inAppPurchaseButton.buttonState == .regular(animate: true, intermediateState: .inactive)) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /InAppPurchaseButtonTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 PGS Software 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "InAppPurchaseButton", 7 | platforms: [ 8 | .macOS("10.15"), 9 | .iOS("8.4") 10 | ], 11 | products: [ 12 | .library(name: "InAppPurchaseButton", targets: ["InAppPurchaseButton"]) 13 | ], 14 | targets: [ 15 | .target( 16 | name: "InAppPurchaseButton", 17 | path: "Sources") 18 | ] 19 | ) 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![pgssoft-logo.png](Assets/pgssoft-logo.png) 2 | 3 | # InAppPurchaseButton 4 | 5 | A simple and customisable in-app purchase button, written in Swift. 6 | 7 | [![Swift 5.0](https://img.shields.io/badge/Swift-5.0-orange)](https://swift.org/) 8 | [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/InAppPurchaseButton.svg)](https://cocoapods.org/pods/InAppPurchaseButton) 9 | [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen)](https://github.com/Carthage/Carthage) 10 | [![SPM](https://img.shields.io/badge/SPM-supported-brightgreen)](https://swift.org/package-manager/) 11 | [![Platform](https://img.shields.io/badge/platform-ios%20%7C%20tvos-lightgrey)](http://cocoadocs.org/docsets/InAppPurchaseButton) 12 | [![License](https://img.shields.io/cocoapods/l/InAppPurchaseButton.svg)](https://github.com/PGSSoft/InAppPurchaseButton/blob/master/LICENSE) 13 | 14 | ![InAppPurchaseButton.gif](Assets/InAppPurchaseButton.gif) 15 | 16 | ## Installation 17 | 18 | The most convenient way to install it is by using [Cocoapods](https://cocoapods.org/) with Podfile: 19 | 20 | ```ruby 21 | pod 'InAppPurchaseButton' 22 | ``` 23 | 24 | or using [Carthage](https://github.com/Carthage/Carthage) and add a line to `Cartfile`: 25 | 26 | ``` 27 | github "PGSSoft/InAppPurchaseButton" 28 | ``` 29 | 30 | or [Swift Package Manager](https://swift.org/package-manager/) (SMP) 31 | 32 | ## Requirements 33 | 34 | iOS, tvOS 9.0 35 | 36 | ## Usage 37 | 38 | ```swift 39 | import InAppPurchaseButton 40 | ``` 41 | 42 | ##### Adding control 43 | 44 | Open your storyboard or xib and drag and drop `UIButton` control. 45 | Change custom class to `InAppPurchaseButton`. 46 | 47 | ##### Adding constraints 48 | 49 | Add constrains, but bear in mind that `InAppPurchaseButton` changes *intrinsic content size* by itself, so adding constrains like height or width will cause unexpected behaviour. 50 | If you want to control size of `InAppPurchaseButton`, take a look at `minExpandedSize` and `prefferedTitleMargins` properties. 51 | 52 | ##### Available states 53 | 54 | `InAppPurchaseButton` might have following states: 55 | 56 | - `regular` (*active* for purchased item or *inactive* for not purchased item) - use it to display text like **Open** (active) or **Buy** (for inactive) 57 | 58 | ![inactive.png](Assets/inactive.png) 59 | 60 | ![active.png](Assets/active.png) 61 | 62 | Example: 63 | ```swift 64 | button.buttonState = .regular(animate: true, intermediateState: .active) 65 | ``` 66 | 67 | - `busy` - intermediate state between `regular` and `downloading`, usually used when application is waiting for something (e.g. response from the server) 68 | 69 | ![busy.png](Assets/busy.png) 70 | 71 | Example: 72 | ```swift 73 | button.buttonState = .busy(animate: true) 74 | ``` 75 | 76 | - `downloading` - showing current progress 77 | 78 | ![downloading.png](Assets/downloading.png) 79 | 80 | Example 81 | ```swift 82 | button.buttonState = .downloading(progress: 0.25) 83 | ``` 84 | 85 | ##### Configurable properties: 86 | - `minExpandedSize` - minimum size for expanded state 87 | - `prefferedTitleMargins` - preferred space between text and edges 88 | - `borderColorForInactiveState` - border color for inactive state 89 | - `borderColorForActiveState` - border color for active state 90 | - `backgroundColorForInactiveState` - fill color of the button in inactive state 91 | - `backgroundColorForActiveState` - fill color of the button in active state 92 | - `imageForInactiveState` - stretchable background image of the button in inactive state 93 | - `imageForActiveState` - stretchable background image of the button in active state 94 | - `widthForBusyView` - diameter of the button in case when indicator view is shown 95 | - `cornerRadiusForExpandedBorder` - corner radius of the border during transition from .regular to .busy state 96 | - `borderWidthForBusyView` - border width for .busy state 97 | - `borderWidthForProgressView` - border width for .downloading state 98 | - `ringColorForProgressView` - color of the ring for .downloading state 99 | - `attributedTextForProgressView` - attributed string for .downloading state 100 | - `indicatorImageForProgressMode` - alternatively it is possible to display image for .downloading state 101 | - `transitionAnimationDuration` - the speed for all transition animations 102 | - `shouldAlwaysDisplayBorder` - indicates whether border for .active or .inactive should be visible all the time or only during transition (false by default) 103 | - `attributedTextForInactiveState` - attributed string for .inactive state 104 | - `attributedTextForActiveState` attributed string for .active state 105 | 106 | For more information, please check ```InAppPurchaseButton.swift``` documentation and examples 107 | 108 | ## Contributing 109 | 110 | Bug reports and pull requests are welcome on GitHub at [https://github.com/PGSSoft/InAppPurchaseButton](https://github.com/PGSSoft/InAppPurchaseButton). 111 | 112 | ## License 113 | 114 | The project is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). 115 | 116 | ## About 117 | 118 | The project maintained by [software development agency](https://www.pgs-soft.com/) [PGS Software](https://www.pgs-soft.com/). 119 | See our other [open-source projects](https://github.com/PGSSoft) or [contact us](https://www.pgs-soft.com/contact-us/) to develop your product. 120 | 121 | ## Follow us 122 | 123 | [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=https://github.com/PGSSoft/InAppPurchaseButton) 124 | [![Twitter Follow](https://img.shields.io/twitter/follow/pgssoftware.svg?style=social&label=Follow)](https://twitter.com/pgssoftware) 125 | 126 | -------------------------------------------------------------------------------- /Sources/DefaultSettings.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultSettings.swift 3 | // InAppPurchaseButton 4 | // 5 | // Created by Paweł Kania on 17/08/16. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | enum DefaultSettings { 12 | static let inactiveStateColor = UIColor(red: 198 / 255, green: 107 / 255, blue: 160 / 255, alpha: 1) 13 | static let activeStateColor = UIColor(red: 129 / 255, green: 209 / 255, blue: 216 / 255, alpha: 1) 14 | 15 | static let focusColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.4) 16 | 17 | static let minExpandedSize = CGSize(width: 90, height: 32) 18 | static let prefferedTitleMargins = CGSize(width: 26, height: 8) 19 | static let widthForBusyView: CGFloat = 32 20 | static let cornerRadiusForExpandedBorder: CGFloat = 2 21 | static let borderWidthForBusyView: CGFloat = 1 22 | static let borderWidthForProgressView: CGFloat = 2 23 | static let animationDuration: TimeInterval = 0.2 24 | } 25 | -------------------------------------------------------------------------------- /Sources/InAppPurchaseButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // InAppPurchaseButton.h 3 | // InAppPurchaseButton 4 | // 5 | // Created by Pawel Kania on 05/05/16. 6 | // 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for InAppPurchaseButton. 12 | FOUNDATION_EXPORT double InAppPurchaseButtonVersionNumber; 13 | 14 | //! Project version string for InAppPurchaseButton. 15 | FOUNDATION_EXPORT const unsigned char InAppPurchaseButtonVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Sources/InAppPurchaseButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InAppPurchaseButton.swift 3 | // InAppPurchaseButton 4 | // 5 | // Created by Paweł Kania on 17/08/16. 6 | // 7 | // 8 | 9 | import UIKit 10 | import QuartzCore 11 | 12 | public enum ButtonState { 13 | case regular(animate: Bool, intermediateState: IntermediateState) 14 | case busy(animate: Bool) 15 | case downloading(progress: CGFloat) 16 | } 17 | 18 | public enum IntermediateState { 19 | case inactive 20 | case active 21 | } 22 | 23 | public func == (left: ButtonState, right: ButtonState) -> Bool { 24 | switch (left, right) { 25 | case (.regular(_, let intermediateStateLeft), .regular(_, let intermediateStateRight)) where intermediateStateLeft == intermediateStateRight: 26 | return true 27 | case (.busy(_), .busy(_)): 28 | return true 29 | case (.downloading(let progressLeft), .downloading(let progressRight)) where progressLeft == progressRight: 30 | return true 31 | default: 32 | return false 33 | } 34 | } 35 | 36 | open class InAppPurchaseButton: UIButton { 37 | 38 | // MARK: - Public properties 39 | 40 | /// The button won't be smaller than *minExpandedSize* (concerns *.Regular(animate: _, intermediateState: _)* state only). 41 | /// 42 | /// Set to *.zero* if this feature shouldn't be applied. 43 | open var minExpandedSize: CGSize = DefaultSettings.minExpandedSize 44 | 45 | /// Text close to edge doesn't look good. Use this property to add some space. 46 | /// Default value means: 13 points on the left and right, 4 points on the top and bottom. 47 | /// Set to *.zero* if this feature shouldn't be applied. 48 | open var prefferedTitleMargins: CGSize = DefaultSettings.prefferedTitleMargins 49 | 50 | /// The color of border in case when *buttonState* is in *.Regular(animate: _, intermediateState: .Inactive)* state. 51 | open var borderColorForInactiveState: UIColor = DefaultSettings.inactiveStateColor 52 | 53 | /// The color of border in case when *buttonState* is in *.Regular(animate: _, intermediateState: .Active)* state. 54 | open var borderColorForActiveState: UIColor = DefaultSettings.activeStateColor 55 | 56 | /// The color of view that appears when button has focus 57 | open var focusColor: UIColor = DefaultSettings.focusColor 58 | 59 | /// Fill color of the button in case when *buttonState* is in *.Regular(animate: _, intermediateState: .Inactive)* state. 60 | /// Might be *nil*, which is equivalent to *.clearColor()*. 61 | open var backgroundColorForInactiveState: UIColor? 62 | 63 | /// Fill color of the button in case when *buttonState* is in *.Regular(animate: _, intermediateState: .Active)* state. 64 | /// Might be *nil*, which is equivalent to *.clearColor()* 65 | open var backgroundColorForActiveState: UIColor? 66 | 67 | /// Background image of the button in case when *buttonState* is in *.Regular(animate: _, intermediateState: .Inactive)* state. 68 | /// Might be *nil* 69 | open var imageForInactiveState: UIImage? 70 | 71 | /// Background image of the button in case when *buttonState* is in *.Regular(animate: _, intermediateState: .Active)* state. 72 | /// Might be *nil* 73 | open var imageForActiveState: UIImage? 74 | 75 | /// Determines the actual diameter of the button in case when *buttonState* is in *.Busy(animate: _)* state. 76 | open var widthForBusyView = DefaultSettings.widthForBusyView 77 | 78 | /// Determines corner radius when button is in transition state (from *.Regular(animate: _, intermediateState: _)* to *.Busy(animate: _)* and in opposite side) 79 | open var cornerRadiusForExpandedBorder = DefaultSettings.cornerRadiusForExpandedBorder 80 | 81 | /// Border width in case when *buttonState* is in *.Busy(animate: _)* state. 82 | open var borderWidthForBusyView = DefaultSettings.borderWidthForBusyView 83 | 84 | /// Border width in case when *buttonState* is in *.Busy(animate: _)* state. 85 | open var borderWidthForProgressView = DefaultSettings.borderWidthForProgressView 86 | 87 | /// Color of the ring in case when *buttonState* is in *.Downloading(progress: _)* state. 88 | open var ringColorForProgressView: UIColor = DefaultSettings.activeStateColor 89 | 90 | /// Attributed text displayed in case when *buttonState* is in *.Downloading(progress: _)* state. 91 | /// Might be *nil* 92 | open var attributedTextForProgressView: NSAttributedString? 93 | 94 | /// Image displayed in case when *buttonState* is in *.Downloading(progress: _)* state. 95 | /// Might be *nil* 96 | open var indicatorImageForProgressMode: UIImage? 97 | 98 | /// Determines the duration of the transition animation 99 | open var transitionAnimationDuration: TimeInterval = DefaultSettings.animationDuration 100 | 101 | /// Determines whether border should be visible all the time or only during transition. 102 | /// **Important!** By default border is visible only during transition. 103 | open var shouldAlwaysDisplayBorder: Bool = false { 104 | didSet { 105 | if shouldAlwaysDisplayBorder { 106 | // In this case we need to force redrawing 107 | // You must set this flag before setting `borderColorForInactiveState` 108 | setupBorderView(cornerRadius: cornerRadiusForExpandedBorder, borderColor: borderColorForInactiveState) 109 | } 110 | } 111 | } 112 | 113 | /// Attributed text displayed in case when *buttonState* is in *.Regular(animate: _, intermediateState: .Inactive)* state. 114 | /// Might be *nil* 115 | open var attributedTextForInactiveState: NSAttributedString? 116 | 117 | /// Attributed text displayed in case when *buttonState* is in *.Regular(animate: _, intermediateState: .Active)* state. 118 | /// Might be *nil* 119 | open var attributedTextForActiveState: NSAttributedString? 120 | 121 | /// Use this to determine button state. 122 | /// - Remark: 123 | /// Following transitions support animation: 124 | /// 1. From *.Regular(animate: _, intermediateState: .Inactive)* to *.Processing(animate: true)* 125 | /// 2. From *.Regular(animate: _, intermediateState: .Active)* to *.Processing(animate: true)* 126 | /// 3. From *.Processing(animate: _)* to *.Regular(animate: true, intermediateState: .Inactive)* 127 | /// 4. From *.Processing(animate: _)* to *.Regular(animate: true, intermediateState: .Active)* 128 | /// 5. From *.Downloading(progress: _)* to *.Regular(animate: true, intermediateState: .Inactive)* 129 | /// 6. From *.Downloading(progress: _)* to *.Regular(animate: true, intermediateState: .Active)* 130 | /// - SeeAlso: `ButtonState` 131 | /// - SeeAlso: `IntermediateState` 132 | open var buttonState = ButtonState.regular(animate: false, intermediateState: .inactive) { 133 | didSet { 134 | switch buttonState { 135 | case let .regular(animate: animate, intermediateState: .inactive): 136 | if oldValue == buttonState { break } 137 | transitionFromBusyToRegular(animate, intermediateState: .inactive) 138 | case let .regular(animate: animate, intermediateState: .active): 139 | if oldValue == buttonState { break } 140 | transitionFromBusyToRegular(animate, intermediateState: .active) 141 | case let .busy(animate: animate): 142 | if oldValue == buttonState { break } 143 | switch oldValue { 144 | case .downloading(_): 145 | transitionFromNormalToBusy(false, intermediateState: lastIntermediateState) 146 | default: 147 | transitionFromNormalToBusy(animate) 148 | } 149 | case let .downloading(progress: progress): 150 | switch oldValue { 151 | case .downloading(_) where (oldValue == buttonState) == false: // Workaround to avoid overloading `!=` 152 | progressView.progress = progress 153 | case .regular(animate: false, intermediateState: .inactive): 154 | fallthrough 155 | case .regular(animate: false, intermediateState: .active): 156 | transitionFromNormalToBusy(false, intermediateState: lastIntermediateState) 157 | fallthrough 158 | default: 159 | transitionFromBusyToDownloading(progress) 160 | } 161 | } 162 | } 163 | } 164 | 165 | // MARK: - Private properties 166 | 167 | private lazy var once: () = { 168 | guard let titleLabel = self.titleLabel else { 169 | return 170 | } 171 | 172 | titleLabel.fulfillSuperview() 173 | self.setAttributedTitle(self.attributedTextForInactiveState, for: UIControl.State()) 174 | 175 | self.colouredBackgroundView = PassthroughView(frame: self.bounds) 176 | self.insertSubview(self.colouredBackgroundView, belowSubview: titleLabel) 177 | self.colouredBackgroundView.fulfillSuperview() 178 | self.colouredBackgroundView.layer.cornerRadius = self.cornerRadiusForExpandedBorder 179 | self.colouredBackgroundView.backgroundColor = self.backgroundColorForInactiveState 180 | 181 | self.focusBackgroundView = PassthroughView(frame: self.bounds) 182 | self.insertSubview(self.focusBackgroundView, belowSubview: titleLabel) 183 | self.focusBackgroundView.fulfillSuperview() 184 | self.focusBackgroundView.layer.cornerRadius = self.cornerRadiusForExpandedBorder 185 | self.focusBackgroundView?.backgroundColor = self.focusColor 186 | self.focusBackgroundView.alpha = 0 187 | 188 | self.backgroundImageView = UIImageView(image: self.imageForInactiveState) 189 | self.insertSubview(self.backgroundImageView, belowSubview: titleLabel) 190 | self.backgroundImageView.fulfillSuperview() 191 | }() 192 | 193 | private var lastRegularButtonState = ButtonState.regular(animate: false, intermediateState: .inactive) { 194 | didSet { 195 | switch lastRegularButtonState { 196 | case .regular(animate: _, intermediateState: _): 197 | break 198 | default: 199 | lastRegularButtonState = oldValue 200 | } 201 | } 202 | } 203 | 204 | private var lastIntermediateState: IntermediateState? { 205 | switch lastRegularButtonState { 206 | case .regular(animate: _, intermediateState: .inactive): 207 | return .inactive 208 | case .regular(animate: _, intermediateState: .active): 209 | return .active 210 | default: 211 | return nil 212 | } 213 | } 214 | 215 | private var cornerRadiusForBusyView: CGFloat { 216 | return widthForBusyView / 2 217 | } 218 | 219 | private var expandedSize: CGSize! { 220 | didSet { 221 | invalidateIntrinsicContentSize() 222 | } 223 | } 224 | 225 | private var backgroundImageView: UIImageView! 226 | private var colouredBackgroundView: PassthroughView! 227 | private var focusBackgroundView: PassthroughView! 228 | private var borderView: PassthroughView! 229 | private var busyView: PassthroughView! 230 | private var progressView: ProgressView! 231 | private var layoutToken: Int = 0 232 | 233 | // MARK: - Initializers 234 | 235 | override init(frame: CGRect) { 236 | super.init(frame: frame) 237 | setTitle(nil, for: UIControl.State()) // Clear placeholder 238 | } 239 | 240 | required public init?(coder aDecoder: NSCoder) { 241 | super.init(coder: aDecoder) 242 | setTitle(nil, for: UIControl.State()) // Clear placeholder 243 | } 244 | 245 | // MARK: - Layout 246 | 247 | override open var intrinsicContentSize: CGSize { 248 | if let expandedSize = expandedSize { 249 | return expandedSize 250 | } 251 | 252 | return super.intrinsicContentSize 253 | } 254 | 255 | open override func layoutSubviews() { 256 | super.layoutSubviews() 257 | _ = self.once 258 | } 259 | 260 | // MARK: - Overwritten methods 261 | 262 | open override func setAttributedTitle(_ title: NSAttributedString?, for state: UIControl.State) { 263 | super.setAttributedTitle(title, for: state) 264 | 265 | if let title = title { 266 | expandedSize = calculatePrefferedSize(title) 267 | } 268 | } 269 | 270 | @available(iOSApplicationExtension 9.0, *) 271 | open override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) { 272 | super.didUpdateFocus(in: context, with: coordinator) 273 | 274 | coordinator.addCoordinatedAnimations({ 275 | if self.isFocused { 276 | self.focusBackgroundView.alpha = 1 277 | } 278 | else { 279 | self.focusBackgroundView.alpha = 0 280 | } 281 | }, completion: nil) 282 | } 283 | 284 | // MARK: - Helpers 285 | 286 | private func calculatePrefferedSize(_ attributedString: NSAttributedString) -> CGSize { 287 | var prefferedSize = attributedString.minSizeForAttributedString 288 | 289 | if prefferedSize.width + prefferedTitleMargins.width < minExpandedSize.width { 290 | prefferedSize.width = minExpandedSize.width 291 | } else { 292 | let prefferedWidth = prefferedSize.width + prefferedTitleMargins.width 293 | prefferedSize.width = prefferedWidth 294 | } 295 | 296 | if prefferedSize.height + prefferedTitleMargins.height < minExpandedSize.height { 297 | prefferedSize.height = minExpandedSize.height 298 | } else { 299 | let prefferedHeight = prefferedSize.height + prefferedTitleMargins.height 300 | prefferedSize.height = prefferedHeight 301 | } 302 | 303 | return prefferedSize 304 | } 305 | 306 | private func setupBorderView(cornerRadius: CGFloat, borderColor: UIColor) { 307 | borderView?.removeFromSuperview() 308 | borderView = PassthroughView(frame: bounds.insetBy(dx: borderWidthForBusyView, dy: borderWidthForBusyView)) 309 | addSubview(borderView) 310 | borderView.fulfillSuperview() 311 | borderView.layer.cornerRadius = cornerRadius 312 | borderView.layer.borderColor = borderColor.cgColor 313 | borderView.layer.borderWidth = borderWidthForBusyView 314 | } 315 | 316 | private func setupBusyView(_ progress: CGFloat = 0.8) { 317 | busyView?.removeFromSuperview() 318 | busyView = PassthroughView(frame: bounds) 319 | addSubview(busyView) 320 | busyView.fulfillSuperview() 321 | let bezierPath = UIBezierPath(ovalIn: bounds.insetBy(dx: borderWidthForBusyView - borderWidthForBusyView / 2, dy: borderWidthForBusyView - borderWidthForBusyView / 2)).cgPath 322 | let progressLayer = CAShapeLayer() 323 | progressLayer.path = bezierPath 324 | progressLayer.strokeColor = borderColorForActiveState.cgColor 325 | progressLayer.fillColor = UIColor.clear.cgColor 326 | progressLayer.lineWidth = borderWidthForBusyView 327 | progressLayer.strokeEnd = progress 328 | busyView.layer.addSublayer(progressLayer) 329 | } 330 | 331 | private func setupBusyViewAnimation() { 332 | let spinAnimation = CABasicAnimation(keyPath: "transform.rotation") 333 | spinAnimation.toValue = 2 * Double.pi 334 | spinAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) 335 | spinAnimation.duration = 1 336 | spinAnimation.repeatCount = Float.infinity 337 | busyView.layer.add(spinAnimation, forKey: "transform.rotation") 338 | } 339 | 340 | private func setupProgressView() { 341 | progressView?.removeFromSuperview() 342 | progressView = ProgressView(frame: bounds, progressColor: ringColorForProgressView, progressBorderWidth: borderWidthForProgressView, attributedText: attributedTextForProgressView, indicatorImage: indicatorImageForProgressMode) 343 | addSubview(progressView) 344 | progressView.fulfillSuperview() 345 | progressView.progress = 0 346 | } 347 | 348 | // MARK: - Transitions 349 | 350 | private func transitionFromNormalToBusy(_ animate: Bool, intermediateState: IntermediateState? = nil) { 351 | busyView?.removeFromSuperview() 352 | progressView?.removeFromSuperview() 353 | 354 | var borderColor: UIColor? 355 | 356 | if let intermediateState = intermediateState { 357 | switch intermediateState { 358 | case .inactive: 359 | borderColor = borderColorForInactiveState 360 | case .active: 361 | borderColor = borderColorForActiveState 362 | } 363 | } 364 | 365 | self.setupBorderView(cornerRadius: self.cornerRadiusForExpandedBorder, borderColor: self.borderColorForInactiveState) 366 | self.borderView.alpha = self.shouldAlwaysDisplayBorder ? 1 : 0 367 | 368 | func generateDummyAttributedString() -> NSAttributedString { 369 | var attributes = [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 17)] 370 | 371 | if let attributedTextForActiveState = attributedTextForActiveState, let attrs = attributedTextForActiveState.attributes(at: 0, longestEffectiveRange: nil, in: NSRange(location: 0, length: attributedTextForActiveState.length)) as? [NSAttributedString.Key: UIFont] { 372 | attributes = attrs 373 | } else if let attributedTextForInactiveState = attributedTextForInactiveState, let attrs = attributedTextForInactiveState.attributes(at: 0, longestEffectiveRange: nil, in: NSRange(location: 0, length: attributedTextForInactiveState.length)) as? [NSAttributedString.Key: UIFont] { 374 | attributes = attrs 375 | } 376 | 377 | return NSAttributedString(string: " ", attributes: attributes) 378 | } 379 | 380 | let animBlock1: () -> Void = { 381 | self.borderView.alpha = 1 382 | self.setAttributedTitle(generateDummyAttributedString(), for: UIControl.State()) // For some reason, in iOS 11, setting attributed title on nil doesn't make button square, but rectangle 383 | self.backgroundImageView?.alpha = 0 384 | self.colouredBackgroundView?.alpha = 0 385 | } 386 | 387 | let setupBusyViewWithAnimation: () -> Void = { 388 | self.borderView.alpha = 0 389 | self.setupBusyView() 390 | self.setupBusyViewAnimation() 391 | } 392 | 393 | let animBlock2: () -> Void = { 394 | if animate { 395 | CATransaction.begin() 396 | CATransaction.setCompletionBlock { 397 | setupBusyViewWithAnimation() 398 | } 399 | 400 | let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius") 401 | cornerAnimation.fromValue = self.cornerRadiusForExpandedBorder 402 | cornerAnimation.toValue = self.cornerRadiusForBusyView 403 | cornerAnimation.duration = self.transitionAnimationDuration 404 | cornerAnimation.fillMode = CAMediaTimingFillMode.forwards 405 | cornerAnimation.isRemovedOnCompletion = false 406 | self.borderView.layer.add(cornerAnimation, forKey: "cornerRadius") 407 | 408 | let colorAnimation = CABasicAnimation(keyPath: "borderColor") 409 | colorAnimation.fromValue = self.borderView.layer.borderColor 410 | colorAnimation.toValue = borderColor != nil ? borderColor!.cgColor : self.borderColorForActiveState.cgColor 411 | colorAnimation.duration = self.transitionAnimationDuration 412 | colorAnimation.fillMode = CAMediaTimingFillMode.forwards 413 | colorAnimation.isRemovedOnCompletion = false 414 | self.borderView.layer.add(colorAnimation, forKey: "borderColor") 415 | 416 | let borderAnimation = CABasicAnimation(keyPath: "borderWidth") 417 | borderAnimation.fromValue = self.borderView.layer.borderWidth 418 | borderAnimation.toValue = self.borderWidthForBusyView 419 | borderAnimation.duration = self.transitionAnimationDuration 420 | borderAnimation.fillMode = CAMediaTimingFillMode.forwards 421 | borderAnimation.isRemovedOnCompletion = false 422 | self.borderView.layer.add(borderAnimation, forKey: "borderWidth") 423 | 424 | CATransaction.commit() 425 | } else { 426 | self.borderView.layer.removeAllAnimations() 427 | self.borderView.layer.cornerRadius = self.cornerRadiusForBusyView 428 | self.borderView.layer.borderColor = self.borderColorForActiveState.cgColor 429 | self.borderView.layer.borderWidth = self.borderWidthForProgressView 430 | } 431 | } 432 | 433 | let animBlock3: () -> Void = { 434 | self.expandedSize = CGSize(width: self.widthForBusyView, height: self.widthForBusyView) 435 | self.superview?.layoutIfNeeded() 436 | 437 | // If animation is disabled, animation of the circle should start after `layoutIfNeeded()` method call 438 | if !animate { 439 | setupBusyViewWithAnimation() 440 | } 441 | } 442 | 443 | if animate { 444 | UIView.animateKeyframes(withDuration: transitionAnimationDuration, delay: 0, options: [.beginFromCurrentState], animations: { 445 | animBlock1() 446 | }, completion: { _ in 447 | animBlock2() 448 | UIView.animateKeyframes(withDuration: self.transitionAnimationDuration, delay: 0, options: [.beginFromCurrentState], animations: { 449 | animBlock3() 450 | }, completion: nil) 451 | }) 452 | } else { 453 | animBlock1() 454 | animBlock2() 455 | animBlock3() 456 | } 457 | } 458 | 459 | private func transitionFromBusyToRegular(_ animate: Bool, intermediateState: IntermediateState) { 460 | progressView?.removeFromSuperview() 461 | 462 | var borderColor: UIColor! 463 | var attributedTextForCurrentState: NSAttributedString? 464 | 465 | switch intermediateState { 466 | case .inactive: 467 | borderColor = borderColorForInactiveState 468 | backgroundImageView?.image = imageForInactiveState 469 | colouredBackgroundView?.backgroundColor = backgroundColorForInactiveState 470 | attributedTextForCurrentState = attributedTextForInactiveState 471 | case .active: 472 | borderColor = borderColorForActiveState 473 | backgroundImageView?.image = imageForActiveState 474 | colouredBackgroundView?.backgroundColor = backgroundColorForActiveState 475 | attributedTextForCurrentState = attributedTextForActiveState 476 | } 477 | 478 | let animBlock1: () -> Void = { 479 | if animate { 480 | self.busyView?.removeFromSuperview() 481 | self.borderView?.alpha = 1 482 | 483 | CATransaction.begin() 484 | 485 | let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius") 486 | cornerAnimation.fromValue = self.cornerRadiusForBusyView 487 | cornerAnimation.toValue = self.cornerRadiusForExpandedBorder 488 | cornerAnimation.duration = self.transitionAnimationDuration 489 | cornerAnimation.fillMode = CAMediaTimingFillMode.forwards 490 | cornerAnimation.isRemovedOnCompletion = false 491 | self.borderView?.layer.add(cornerAnimation, forKey: "cornerRadius") 492 | 493 | let colorAnimation = CABasicAnimation(keyPath: "borderColor") 494 | colorAnimation.fromValue = self.borderView?.layer.borderColor 495 | colorAnimation.toValue = borderColor.cgColor 496 | colorAnimation.duration = self.transitionAnimationDuration 497 | colorAnimation.fillMode = CAMediaTimingFillMode.forwards 498 | colorAnimation.isRemovedOnCompletion = false 499 | self.borderView?.layer.add(colorAnimation, forKey: "borderColor") 500 | 501 | let borderAnimation = CABasicAnimation(keyPath: "borderWidth") 502 | borderAnimation.fromValue = self.borderView?.layer.borderWidth 503 | borderAnimation.toValue = self.borderWidthForBusyView 504 | borderAnimation.duration = self.transitionAnimationDuration 505 | borderAnimation.fillMode = CAMediaTimingFillMode.forwards 506 | borderAnimation.isRemovedOnCompletion = false 507 | self.borderView?.layer.add(borderAnimation, forKey: "borderWidth") 508 | 509 | CATransaction.commit() 510 | } else { 511 | self.busyView?.removeFromSuperview() 512 | self.borderView?.layer.removeAllAnimations() 513 | self.borderView?.alpha = self.shouldAlwaysDisplayBorder ? 1 : 0 514 | self.borderView?.layer.cornerRadius = self.cornerRadiusForExpandedBorder 515 | self.borderView?.layer.borderColor = borderColor.cgColor 516 | self.borderView?.layer.borderWidth = self.borderWidthForBusyView 517 | } 518 | } 519 | 520 | let animBlock2: () -> Void = { 521 | if let attributedTextForCurrentState = attributedTextForCurrentState { 522 | self.expandedSize = self.calculatePrefferedSize(attributedTextForCurrentState) 523 | } else { 524 | self.expandedSize = self.minExpandedSize 525 | } 526 | 527 | self.superview?.layoutIfNeeded() 528 | } 529 | 530 | let animBlock3: () -> Void = { 531 | self.setAttributedTitle(attributedTextForCurrentState, for: UIControl.State()) 532 | self.backgroundImageView?.alpha = 1 533 | self.colouredBackgroundView?.alpha = 1 534 | } 535 | 536 | let animBlock4: () -> Void = { 537 | self.borderView?.alpha = self.shouldAlwaysDisplayBorder ? 1 : 0 538 | } 539 | 540 | if animate { 541 | animBlock1() 542 | UIView.animateKeyframes(withDuration: self.transitionAnimationDuration, delay: 0, options: [.beginFromCurrentState], animations: { 543 | animBlock2() 544 | }, completion: { (_) in 545 | UIView.animateKeyframes(withDuration: self.transitionAnimationDuration, delay: 0, options: [.beginFromCurrentState], animations: { 546 | animBlock3() 547 | }, completion: { _ in 548 | UIView.animateKeyframes(withDuration: self.transitionAnimationDuration, delay: 0, options: [.beginFromCurrentState], animations: { 549 | animBlock4() 550 | }, completion: nil) 551 | }) 552 | }) 553 | } else { 554 | animBlock1() 555 | animBlock2() 556 | animBlock3() 557 | animBlock4() 558 | } 559 | } 560 | 561 | private func transitionFromBusyToDownloading(_ progress: CGFloat) { 562 | busyView?.removeFromSuperview() 563 | setupBorderView(cornerRadius: cornerRadiusForBusyView, borderColor: borderColorForActiveState) 564 | setupProgressView() 565 | progressView.progress = progress 566 | } 567 | } 568 | -------------------------------------------------------------------------------- /Sources/Info-iOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sources/NSAttributedString+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+Extensions.swift 3 | // InAppPurchaseButton 4 | // 5 | // Created by Paweł Kania on 17/08/16. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | extension NSAttributedString { 12 | 13 | /// Gives minimal possible size required to display inside UILabel 14 | var minSizeForAttributedString: CGSize { 15 | let label = UILabel(frame: .zero) 16 | label.attributedText = self 17 | label.sizeToFit() 18 | return label.frame.size 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/PassthroughView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PassthroughView.swift 3 | // InAppPurchaseButton 4 | // 5 | // Created by Paweł Kania on 17/08/16. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | class PassthroughView: UIView { 12 | 13 | override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { 14 | let hitView = super.hitTest(point, with: event) 15 | if hitView == self { 16 | return nil 17 | } 18 | return hitView 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/ProgressView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressView.swift 3 | // InAppPurchaseButton 4 | // 5 | // Created by Paweł Kania on 17/08/16. 6 | // 7 | // 8 | 9 | import UIKit 10 | import CoreGraphics 11 | import UIKit 12 | class ProgressView: PassthroughView { 13 | 14 | // MARK: - Properties 15 | 16 | private let progressLayer = CAShapeLayer() 17 | private var progressColor: UIColor = DefaultSettings.activeStateColor 18 | private var progressBorderWidth: CGFloat = 2 19 | private var attributedText: NSAttributedString? 20 | private var indicatorImage: UIImage? 21 | 22 | var progress: CGFloat = 0 { 23 | didSet { 24 | var value = progress 25 | if progress > 1 { 26 | value = 1 27 | } else if value < 0 { 28 | value = 0 29 | } 30 | progress = value 31 | progressLayer.strokeEnd = progress 32 | } 33 | } 34 | 35 | // MARK: - Initializers 36 | 37 | init(frame: CGRect, progressColor: UIColor, progressBorderWidth: CGFloat, attributedText: NSAttributedString?, indicatorImage: UIImage?) { 38 | super.init(frame: frame) 39 | self.progressColor = progressColor 40 | self.progressBorderWidth = progressBorderWidth 41 | self.attributedText = attributedText 42 | self.indicatorImage = indicatorImage 43 | setupView() 44 | } 45 | 46 | required init?(coder aDecoder: NSCoder) { 47 | super.init(coder: aDecoder) 48 | setupView() 49 | } 50 | 51 | // MARK: - Layout 52 | 53 | override func layoutSubviews() { 54 | super.layoutSubviews() 55 | progressLayer.frame = bounds 56 | progressLayer.path = UIBezierPath(ovalIn: bounds.insetBy(dx: progressBorderWidth - progressBorderWidth / 2, dy: progressBorderWidth - progressBorderWidth / 2)).cgPath 57 | } 58 | 59 | // MARK: - Helpers 60 | 61 | fileprivate func setupView() { 62 | // Setup ring 63 | progressLayer.frame = bounds 64 | progressLayer.lineWidth = progressBorderWidth 65 | progressLayer.fillColor = UIColor.clear.cgColor 66 | progressLayer.strokeColor = progressColor.cgColor 67 | progressLayer.anchorPoint = CGPoint(x: 0.5, y: 0.5) 68 | progressLayer.transform = CATransform3DRotate(progressLayer.transform, -CGFloat(Double.pi/2), 0, 0, 1) 69 | layer.addSublayer(progressLayer) 70 | 71 | if let attributedString = attributedText { 72 | let ringLabel = UILabel(frame: bounds) 73 | ringLabel.attributedText = attributedString 74 | addSubview(ringLabel) 75 | ringLabel.centerInSuperview() 76 | } 77 | 78 | if let ringImage = indicatorImage { 79 | let ringImageView = UIImageView(image: ringImage) 80 | addSubview(ringImageView) 81 | ringImageView.centerInSuperview() 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Sources/UIView+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Extensions.swift 3 | // InAppPurchaseButton 4 | // 5 | // Created by Paweł Kania on 17/08/16. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | 13 | /** 14 | Stretches the view in superview by adding four constraints with attributes: *.Top*, *.Bottom*, *.Leading*, *.Trailing* 15 | 16 | **Important!** View needs to have superview, before calling this method 17 | */ 18 | func fulfillSuperview() { 19 | assert(superview != nil, "View should have a superview") 20 | 21 | guard let superview = superview else { 22 | return 23 | } 24 | 25 | translatesAutoresizingMaskIntoConstraints = false 26 | 27 | let topConstraint = NSLayoutConstraint(item: self, 28 | attribute: .top, 29 | relatedBy: .equal, 30 | toItem: superview, 31 | attribute: .top, 32 | multiplier: 1, 33 | constant: 0) 34 | let bottomConstraint = NSLayoutConstraint(item: self, 35 | attribute: .bottom, 36 | relatedBy: .equal, 37 | toItem: superview, 38 | attribute: .bottom, 39 | multiplier: 1, 40 | constant: 0) 41 | let leadingConstraint = NSLayoutConstraint(item: self, 42 | attribute: .leading, 43 | relatedBy: .equal, 44 | toItem: superview, 45 | attribute: .leading, 46 | multiplier: 1, 47 | constant: 0) 48 | let trailingConstraint = NSLayoutConstraint(item: self, 49 | attribute: .trailing, 50 | relatedBy: .equal, 51 | toItem: superview, 52 | attribute: .trailing, 53 | multiplier: 1, 54 | constant: 0) 55 | 56 | superview.addConstraints([bottomConstraint, topConstraint, leadingConstraint, trailingConstraint]) 57 | } 58 | 59 | /** 60 | Adds two constraints to the view (with attributes: *.CenterX* and *.CenterY*). 61 | 62 | **Important!** View needs to have superview, before calling this method 63 | */ 64 | func centerInSuperview() { 65 | assert(superview != nil, "View should have a superview") 66 | 67 | guard let superview = superview else { 68 | return 69 | } 70 | 71 | translatesAutoresizingMaskIntoConstraints = false 72 | 73 | let centerXConstraint = NSLayoutConstraint(item: self, 74 | attribute: .centerX, 75 | relatedBy: .equal, 76 | toItem: superview, 77 | attribute: .centerX, 78 | multiplier: 1, 79 | constant: 0) 80 | let centerYConstraint = NSLayoutConstraint(item: self, 81 | attribute: .centerY, 82 | relatedBy: .equal, 83 | toItem: superview, 84 | attribute: .centerY, 85 | multiplier: 1, 86 | constant: 0) 87 | 88 | superview.addConstraints([centerXConstraint, centerYConstraint]) 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /iOS Example/iOS Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4834F1EF1CDCD65400F5BD6D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4834F1EE1CDCD65400F5BD6D /* AppDelegate.swift */; }; 11 | 4834F1F11CDCD65400F5BD6D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4834F1F01CDCD65400F5BD6D /* ViewController.swift */; }; 12 | 4834F1F41CDCD65400F5BD6D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4834F1F21CDCD65400F5BD6D /* Main.storyboard */; }; 13 | 4834F1F61CDCD65400F5BD6D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4834F1F51CDCD65400F5BD6D /* Assets.xcassets */; }; 14 | 4834F1F91CDCD65400F5BD6D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4834F1F71CDCD65400F5BD6D /* LaunchScreen.storyboard */; }; 15 | 484E3CE81CE0693100B08B37 /* InAppPurchaseButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 484E3CE71CE0692900B08B37 /* InAppPurchaseButton.framework */; }; 16 | 9ACB2648221ED3EA004C7CDB /* InAppPurchaseButton.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 484E3CE71CE0692900B08B37 /* InAppPurchaseButton.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 484E3CE61CE0692900B08B37 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 484E3CE21CE0692900B08B37 /* InAppPurchaseButton.xcodeproj */; 23 | proxyType = 2; 24 | remoteGlobalIDString = 48B973341CDB44710015E695; 25 | remoteInfo = "InAppPurchaseButton iOS"; 26 | }; 27 | 48B932A61D66DF1F00403C4C /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 484E3CE21CE0692900B08B37 /* InAppPurchaseButton.xcodeproj */; 30 | proxyType = 2; 31 | remoteGlobalIDString = 48AF07CA1D65ED49009E9CBF; 32 | remoteInfo = InAppPurchaseButtonTests; 33 | }; 34 | 9ACB2641221ED1BF004C7CDB /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 484E3CE21CE0692900B08B37 /* InAppPurchaseButton.xcodeproj */; 37 | proxyType = 2; 38 | remoteGlobalIDString = 9ACB2631221ED0C7004C7CDB; 39 | remoteInfo = "InAppPurchaseButton tvOS"; 40 | }; 41 | 9ACB2643221ED1C2004C7CDB /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = 484E3CE21CE0692900B08B37 /* InAppPurchaseButton.xcodeproj */; 44 | proxyType = 1; 45 | remoteGlobalIDString = 48B973331CDB44710015E695; 46 | remoteInfo = "InAppPurchaseButton iOS"; 47 | }; 48 | /* End PBXContainerItemProxy section */ 49 | 50 | /* Begin PBXCopyFilesBuildPhase section */ 51 | 4834F2111CDCD84E00F5BD6D /* Embed Frameworks */ = { 52 | isa = PBXCopyFilesBuildPhase; 53 | buildActionMask = 2147483647; 54 | dstPath = ""; 55 | dstSubfolderSpec = 10; 56 | files = ( 57 | 9ACB2648221ED3EA004C7CDB /* InAppPurchaseButton.framework in Embed Frameworks */, 58 | ); 59 | name = "Embed Frameworks"; 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXCopyFilesBuildPhase section */ 63 | 64 | /* Begin PBXFileReference section */ 65 | 4834F1EB1CDCD65400F5BD6D /* iOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 66 | 4834F1EE1CDCD65400F5BD6D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 67 | 4834F1F01CDCD65400F5BD6D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 68 | 4834F1F31CDCD65400F5BD6D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 69 | 4834F1F51CDCD65400F5BD6D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 70 | 4834F1F81CDCD65400F5BD6D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 71 | 4834F1FA1CDCD65400F5BD6D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 72 | 484E3CE21CE0692900B08B37 /* InAppPurchaseButton.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = InAppPurchaseButton.xcodeproj; path = ../InAppPurchaseButton.xcodeproj; sourceTree = ""; }; 73 | /* End PBXFileReference section */ 74 | 75 | /* Begin PBXFrameworksBuildPhase section */ 76 | 4834F1E81CDCD65400F5BD6D /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | 484E3CE81CE0693100B08B37 /* InAppPurchaseButton.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | 4834F1E21CDCD65400F5BD6D = { 88 | isa = PBXGroup; 89 | children = ( 90 | 4834F1ED1CDCD65400F5BD6D /* iOS Example */, 91 | 4834F1EC1CDCD65400F5BD6D /* Products */, 92 | 484E3CE21CE0692900B08B37 /* InAppPurchaseButton.xcodeproj */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 4834F1EC1CDCD65400F5BD6D /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 4834F1EB1CDCD65400F5BD6D /* iOS Example.app */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 4834F1ED1CDCD65400F5BD6D /* iOS Example */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 4834F1EE1CDCD65400F5BD6D /* AppDelegate.swift */, 108 | 4834F1F01CDCD65400F5BD6D /* ViewController.swift */, 109 | 4834F1F21CDCD65400F5BD6D /* Main.storyboard */, 110 | 4834F1F51CDCD65400F5BD6D /* Assets.xcassets */, 111 | 4834F1F71CDCD65400F5BD6D /* LaunchScreen.storyboard */, 112 | 4834F1FA1CDCD65400F5BD6D /* Info.plist */, 113 | ); 114 | path = "iOS Example"; 115 | sourceTree = ""; 116 | }; 117 | 484E3CE31CE0692900B08B37 /* Products */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 484E3CE71CE0692900B08B37 /* InAppPurchaseButton.framework */, 121 | 9ACB2642221ED1BF004C7CDB /* InAppPurchaseButton.framework */, 122 | 48B932A71D66DF1F00403C4C /* InAppPurchaseButtonTests.xctest */, 123 | ); 124 | name = Products; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | 4834F1EA1CDCD65400F5BD6D /* iOS Example */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = 4834F1FD1CDCD65400F5BD6D /* Build configuration list for PBXNativeTarget "iOS Example" */; 133 | buildPhases = ( 134 | 4834F1E71CDCD65400F5BD6D /* Sources */, 135 | 4834F1E81CDCD65400F5BD6D /* Frameworks */, 136 | 4834F1E91CDCD65400F5BD6D /* Resources */, 137 | 4834F2111CDCD84E00F5BD6D /* Embed Frameworks */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | 9ACB2644221ED1C2004C7CDB /* PBXTargetDependency */, 143 | ); 144 | name = "iOS Example"; 145 | productName = "iOS Example"; 146 | productReference = 4834F1EB1CDCD65400F5BD6D /* iOS Example.app */; 147 | productType = "com.apple.product-type.application"; 148 | }; 149 | /* End PBXNativeTarget section */ 150 | 151 | /* Begin PBXProject section */ 152 | 4834F1E31CDCD65400F5BD6D /* Project object */ = { 153 | isa = PBXProject; 154 | attributes = { 155 | LastSwiftUpdateCheck = 0730; 156 | LastUpgradeCheck = 1200; 157 | ORGANIZATIONNAME = "PGS Software"; 158 | TargetAttributes = { 159 | 4834F1EA1CDCD65400F5BD6D = { 160 | CreatedOnToolsVersion = 7.3.1; 161 | LastSwiftMigration = 1020; 162 | }; 163 | }; 164 | }; 165 | buildConfigurationList = 4834F1E61CDCD65400F5BD6D /* Build configuration list for PBXProject "iOS Example" */; 166 | compatibilityVersion = "Xcode 3.2"; 167 | developmentRegion = en; 168 | hasScannedForEncodings = 0; 169 | knownRegions = ( 170 | Base, 171 | en, 172 | ); 173 | mainGroup = 4834F1E21CDCD65400F5BD6D; 174 | productRefGroup = 4834F1EC1CDCD65400F5BD6D /* Products */; 175 | projectDirPath = ""; 176 | projectReferences = ( 177 | { 178 | ProductGroup = 484E3CE31CE0692900B08B37 /* Products */; 179 | ProjectRef = 484E3CE21CE0692900B08B37 /* InAppPurchaseButton.xcodeproj */; 180 | }, 181 | ); 182 | projectRoot = ""; 183 | targets = ( 184 | 4834F1EA1CDCD65400F5BD6D /* iOS Example */, 185 | ); 186 | }; 187 | /* End PBXProject section */ 188 | 189 | /* Begin PBXReferenceProxy section */ 190 | 484E3CE71CE0692900B08B37 /* InAppPurchaseButton.framework */ = { 191 | isa = PBXReferenceProxy; 192 | fileType = wrapper.framework; 193 | path = InAppPurchaseButton.framework; 194 | remoteRef = 484E3CE61CE0692900B08B37 /* PBXContainerItemProxy */; 195 | sourceTree = BUILT_PRODUCTS_DIR; 196 | }; 197 | 48B932A71D66DF1F00403C4C /* InAppPurchaseButtonTests.xctest */ = { 198 | isa = PBXReferenceProxy; 199 | fileType = wrapper.cfbundle; 200 | path = InAppPurchaseButtonTests.xctest; 201 | remoteRef = 48B932A61D66DF1F00403C4C /* PBXContainerItemProxy */; 202 | sourceTree = BUILT_PRODUCTS_DIR; 203 | }; 204 | 9ACB2642221ED1BF004C7CDB /* InAppPurchaseButton.framework */ = { 205 | isa = PBXReferenceProxy; 206 | fileType = wrapper.framework; 207 | path = InAppPurchaseButton.framework; 208 | remoteRef = 9ACB2641221ED1BF004C7CDB /* PBXContainerItemProxy */; 209 | sourceTree = BUILT_PRODUCTS_DIR; 210 | }; 211 | /* End PBXReferenceProxy section */ 212 | 213 | /* Begin PBXResourcesBuildPhase section */ 214 | 4834F1E91CDCD65400F5BD6D /* Resources */ = { 215 | isa = PBXResourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 4834F1F91CDCD65400F5BD6D /* LaunchScreen.storyboard in Resources */, 219 | 4834F1F61CDCD65400F5BD6D /* Assets.xcassets in Resources */, 220 | 4834F1F41CDCD65400F5BD6D /* Main.storyboard in Resources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | /* End PBXResourcesBuildPhase section */ 225 | 226 | /* Begin PBXSourcesBuildPhase section */ 227 | 4834F1E71CDCD65400F5BD6D /* Sources */ = { 228 | isa = PBXSourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | 4834F1F11CDCD65400F5BD6D /* ViewController.swift in Sources */, 232 | 4834F1EF1CDCD65400F5BD6D /* AppDelegate.swift in Sources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXSourcesBuildPhase section */ 237 | 238 | /* Begin PBXTargetDependency section */ 239 | 9ACB2644221ED1C2004C7CDB /* PBXTargetDependency */ = { 240 | isa = PBXTargetDependency; 241 | name = "InAppPurchaseButton iOS"; 242 | targetProxy = 9ACB2643221ED1C2004C7CDB /* PBXContainerItemProxy */; 243 | }; 244 | /* End PBXTargetDependency section */ 245 | 246 | /* Begin PBXVariantGroup section */ 247 | 4834F1F21CDCD65400F5BD6D /* Main.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 4834F1F31CDCD65400F5BD6D /* Base */, 251 | ); 252 | name = Main.storyboard; 253 | sourceTree = ""; 254 | }; 255 | 4834F1F71CDCD65400F5BD6D /* LaunchScreen.storyboard */ = { 256 | isa = PBXVariantGroup; 257 | children = ( 258 | 4834F1F81CDCD65400F5BD6D /* Base */, 259 | ); 260 | name = LaunchScreen.storyboard; 261 | sourceTree = ""; 262 | }; 263 | /* End PBXVariantGroup section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | 4834F1FB1CDCD65400F5BD6D /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 271 | CLANG_ANALYZER_NONNULL = YES; 272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 273 | CLANG_CXX_LIBRARY = "libc++"; 274 | CLANG_ENABLE_MODULES = YES; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_COMMA = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_EMPTY_BODY = YES; 283 | CLANG_WARN_ENUM_CONVERSION = YES; 284 | CLANG_WARN_INFINITE_RECURSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 287 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 288 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 289 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 290 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 291 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 292 | CLANG_WARN_STRICT_PROTOTYPES = YES; 293 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 294 | CLANG_WARN_UNREACHABLE_CODE = YES; 295 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 296 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 297 | COPY_PHASE_STRIP = NO; 298 | DEBUG_INFORMATION_FORMAT = dwarf; 299 | ENABLE_STRICT_OBJC_MSGSEND = YES; 300 | ENABLE_TESTABILITY = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu99; 302 | GCC_DYNAMIC_NO_PIC = NO; 303 | GCC_NO_COMMON_BLOCKS = YES; 304 | GCC_OPTIMIZATION_LEVEL = 0; 305 | GCC_PREPROCESSOR_DEFINITIONS = ( 306 | "DEBUG=1", 307 | "$(inherited)", 308 | ); 309 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 310 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 311 | GCC_WARN_UNDECLARED_SELECTOR = YES; 312 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 313 | GCC_WARN_UNUSED_FUNCTION = YES; 314 | GCC_WARN_UNUSED_VARIABLE = YES; 315 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 316 | MTL_ENABLE_DEBUG_INFO = YES; 317 | ONLY_ACTIVE_ARCH = YES; 318 | SDKROOT = iphoneos; 319 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 320 | TARGETED_DEVICE_FAMILY = "1,2"; 321 | }; 322 | name = Debug; 323 | }; 324 | 4834F1FC1CDCD65400F5BD6D /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 329 | CLANG_ANALYZER_NONNULL = YES; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 335 | CLANG_WARN_BOOL_CONVERSION = YES; 336 | CLANG_WARN_COMMA = YES; 337 | CLANG_WARN_CONSTANT_CONVERSION = YES; 338 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INFINITE_RECURSION = YES; 343 | CLANG_WARN_INT_CONVERSION = YES; 344 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 345 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 346 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 349 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 350 | CLANG_WARN_STRICT_PROTOTYPES = YES; 351 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 352 | CLANG_WARN_UNREACHABLE_CODE = YES; 353 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 354 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 357 | ENABLE_NS_ASSERTIONS = NO; 358 | ENABLE_STRICT_OBJC_MSGSEND = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu99; 360 | GCC_NO_COMMON_BLOCKS = YES; 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 368 | MTL_ENABLE_DEBUG_INFO = NO; 369 | SDKROOT = iphoneos; 370 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | VALIDATE_PRODUCT = YES; 373 | }; 374 | name = Release; 375 | }; 376 | 4834F1FE1CDCD65400F5BD6D /* Debug */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 380 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 381 | INFOPLIST_FILE = "iOS Example/Info.plist"; 382 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 383 | PRODUCT_BUNDLE_IDENTIFIER = "com.pgs-soft.open-source.in-app-purchase-button.ios-example"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | SWIFT_VERSION = 5.0; 386 | }; 387 | name = Debug; 388 | }; 389 | 4834F1FF1CDCD65400F5BD6D /* Release */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 393 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 394 | INFOPLIST_FILE = "iOS Example/Info.plist"; 395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 396 | PRODUCT_BUNDLE_IDENTIFIER = "com.pgs-soft.open-source.in-app-purchase-button.ios-example"; 397 | PRODUCT_NAME = "$(TARGET_NAME)"; 398 | SWIFT_VERSION = 5.0; 399 | }; 400 | name = Release; 401 | }; 402 | /* End XCBuildConfiguration section */ 403 | 404 | /* Begin XCConfigurationList section */ 405 | 4834F1E61CDCD65400F5BD6D /* Build configuration list for PBXProject "iOS Example" */ = { 406 | isa = XCConfigurationList; 407 | buildConfigurations = ( 408 | 4834F1FB1CDCD65400F5BD6D /* Debug */, 409 | 4834F1FC1CDCD65400F5BD6D /* Release */, 410 | ); 411 | defaultConfigurationIsVisible = 0; 412 | defaultConfigurationName = Release; 413 | }; 414 | 4834F1FD1CDCD65400F5BD6D /* Build configuration list for PBXNativeTarget "iOS Example" */ = { 415 | isa = XCConfigurationList; 416 | buildConfigurations = ( 417 | 4834F1FE1CDCD65400F5BD6D /* Debug */, 418 | 4834F1FF1CDCD65400F5BD6D /* Release */, 419 | ); 420 | defaultConfigurationIsVisible = 0; 421 | defaultConfigurationName = Release; 422 | }; 423 | /* End XCConfigurationList section */ 424 | }; 425 | rootObject = 4834F1E31CDCD65400F5BD6D /* Project object */; 426 | } 427 | -------------------------------------------------------------------------------- /iOS Example/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // iOS Example 4 | // 5 | // Created by Pawel Kania on 06/05/16. 6 | // Copyright © 2016 PGS Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillResignActive(_ application: UIApplication) { 22 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 23 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 24 | } 25 | 26 | func applicationDidEnterBackground(_ application: UIApplication) { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | func applicationWillEnterForeground(_ application: UIApplication) { 32 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 33 | } 34 | 35 | func applicationDidBecomeActive(_ application: UIApplication) { 36 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 37 | } 38 | 39 | func applicationWillTerminate(_ application: UIApplication) { 40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/bluebutton.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "resizing" : { 5 | "mode" : "9-part", 6 | "center" : { 7 | "mode" : "tile", 8 | "width" : 1, 9 | "height" : 1 10 | }, 11 | "cap-insets" : { 12 | "bottom" : 5, 13 | "top" : 3, 14 | "right" : 2, 15 | "left" : 2 16 | } 17 | }, 18 | "idiom" : "universal", 19 | "filename" : "bluebutton.png", 20 | "scale" : "1x" 21 | }, 22 | { 23 | "resizing" : { 24 | "mode" : "9-part", 25 | "center" : { 26 | "mode" : "tile", 27 | "width" : 1, 28 | "height" : 1 29 | }, 30 | "cap-insets" : { 31 | "bottom" : 10, 32 | "top" : 5, 33 | "right" : 5, 34 | "left" : 5 35 | } 36 | }, 37 | "idiom" : "universal", 38 | "filename" : "bluebutton@2x.png", 39 | "scale" : "2x" 40 | }, 41 | { 42 | "resizing" : { 43 | "mode" : "9-part", 44 | "center" : { 45 | "mode" : "tile", 46 | "width" : 1, 47 | "height" : 1 48 | }, 49 | "cap-insets" : { 50 | "bottom" : 16, 51 | "top" : 7, 52 | "right" : 7, 53 | "left" : 7 54 | } 55 | }, 56 | "idiom" : "universal", 57 | "filename" : "bluebutton@3x.png", 58 | "scale" : "3x" 59 | } 60 | ], 61 | "info" : { 62 | "version" : 1, 63 | "author" : "xcode" 64 | } 65 | } -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/bluebutton.imageset/bluebutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/bluebutton.imageset/bluebutton.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/bluebutton.imageset/bluebutton@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/bluebutton.imageset/bluebutton@2x.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/bluebutton.imageset/bluebutton@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/bluebutton.imageset/bluebutton@3x.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/pinkbutton.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "resizing" : { 5 | "mode" : "9-part", 6 | "center" : { 7 | "mode" : "tile", 8 | "width" : 1, 9 | "height" : 1 10 | }, 11 | "cap-insets" : { 12 | "bottom" : 5, 13 | "top" : 3, 14 | "right" : 2, 15 | "left" : 2 16 | } 17 | }, 18 | "idiom" : "universal", 19 | "filename" : "pinkbutton.png", 20 | "scale" : "1x" 21 | }, 22 | { 23 | "resizing" : { 24 | "mode" : "9-part", 25 | "center" : { 26 | "mode" : "tile", 27 | "width" : 1, 28 | "height" : 1 29 | }, 30 | "cap-insets" : { 31 | "bottom" : 10, 32 | "top" : 5, 33 | "right" : 5, 34 | "left" : 5 35 | } 36 | }, 37 | "idiom" : "universal", 38 | "filename" : "pinkbutton@2x.png", 39 | "scale" : "2x" 40 | }, 41 | { 42 | "resizing" : { 43 | "mode" : "9-part", 44 | "center" : { 45 | "mode" : "tile", 46 | "width" : 1, 47 | "height" : 1 48 | }, 49 | "cap-insets" : { 50 | "bottom" : 17, 51 | "top" : 7, 52 | "right" : 7, 53 | "left" : 7 54 | } 55 | }, 56 | "idiom" : "universal", 57 | "filename" : "pinkbutton@3x.png", 58 | "scale" : "3x" 59 | } 60 | ], 61 | "info" : { 62 | "version" : 1, 63 | "author" : "xcode" 64 | } 65 | } -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/pinkbutton.imageset/pinkbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/pinkbutton.imageset/pinkbutton.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/pinkbutton.imageset/pinkbutton@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/pinkbutton.imageset/pinkbutton@2x.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/pinkbutton.imageset/pinkbutton@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/pinkbutton.imageset/pinkbutton@3x.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/progress-indicator.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "progress-indicator.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "progress-indicator@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "progress-indicator@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/progress-indicator.imageset/progress-indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/progress-indicator.imageset/progress-indicator.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/progress-indicator.imageset/progress-indicator@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/progress-indicator.imageset/progress-indicator@2x.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/progress-indicator.imageset/progress-indicator@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PGSSoft/InAppPurchaseButton/ae0c8a293353334bfa1207a4bd67f813ddc8dd11/iOS Example/iOS Example/Assets.xcassets/progress-indicator.imageset/progress-indicator@3x.png -------------------------------------------------------------------------------- /iOS Example/iOS Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 28 | 35 | 42 | 49 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // iOS Example 4 | // 5 | // Created by Pawel Kania on 06/05/16. 6 | // Copyright © 2016 PGS Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import InAppPurchaseButton 11 | 12 | class ViewController: UIViewController { 13 | 14 | // MARK: - Outlets 15 | 16 | @IBOutlet weak var inAppPurchaseButton1: InAppPurchaseButton! { 17 | didSet { 18 | inAppPurchaseButton1.attributedTextForInactiveState = generateAttributedString("$1.99", fontColor: .white) 19 | inAppPurchaseButton1.attributedTextForActiveState = generateAttributedString("Open", fontColor: .white) 20 | inAppPurchaseButton1.imageForInactiveState = UIImage(named: "pinkbutton") 21 | inAppPurchaseButton1.imageForActiveState = UIImage(named: "bluebutton") 22 | inAppPurchaseButton1.attributedTextForProgressView = generateAttributedString("⇣", fontColor: defaultActiveColor) 23 | } 24 | } 25 | @IBOutlet weak var inAppPurchaseButton2: InAppPurchaseButton! { 26 | didSet { 27 | inAppPurchaseButton2.attributedTextForInactiveState = generateAttributedString("$0.99", fontColor: defaultInactiveColor) 28 | inAppPurchaseButton2.attributedTextForActiveState = generateAttributedString("Open", fontColor: defaultActiveColor) 29 | inAppPurchaseButton2.cornerRadiusForExpandedBorder = 8 30 | inAppPurchaseButton2.borderWidthForProgressView = 4 31 | inAppPurchaseButton2.shouldAlwaysDisplayBorder = true 32 | } 33 | } 34 | @IBOutlet weak var inAppPurchaseButton3: InAppPurchaseButton! { 35 | didSet { 36 | inAppPurchaseButton3.attributedTextForInactiveState = generateAttributedString("$4.99", fontColor: .white) 37 | inAppPurchaseButton3.attributedTextForActiveState = generateAttributedString("Open", fontColor: .white) 38 | inAppPurchaseButton3.cornerRadiusForExpandedBorder = 10 39 | inAppPurchaseButton3.borderWidthForProgressView = 3 40 | inAppPurchaseButton3.backgroundColorForInactiveState = defaultInactiveColor 41 | inAppPurchaseButton3.backgroundColorForActiveState = defaultActiveColor 42 | inAppPurchaseButton3.attributedTextForProgressView = generateAttributedString("◼︎", fontColor: defaultActiveColor) 43 | } 44 | } 45 | @IBOutlet weak var inAppPurchaseButton4: InAppPurchaseButton! { 46 | didSet { 47 | let activeColor = UIColor(red: 130 / 255, green: 184 / 255, blue: 59 / 255, alpha: 1) 48 | let inactiveColor = UIColor(red: 89 / 255, green: 116 / 255, blue: 146 / 255, alpha: 1) 49 | 50 | inAppPurchaseButton4.attributedTextForInactiveState = generateAttributedString("$6.99", fontColor: .white) 51 | inAppPurchaseButton4.attributedTextForActiveState = generateAttributedString("Open", fontColor: .white) 52 | inAppPurchaseButton4.backgroundColorForInactiveState = inactiveColor 53 | inAppPurchaseButton4.backgroundColorForActiveState = activeColor 54 | inAppPurchaseButton4.borderColorForInactiveState = inactiveColor 55 | inAppPurchaseButton4.borderColorForActiveState = activeColor 56 | inAppPurchaseButton4.ringColorForProgressView = activeColor 57 | inAppPurchaseButton4.indicatorImageForProgressMode = UIImage(named: "progress-indicator") 58 | } 59 | } 60 | @IBOutlet weak var inAppPurchaseButton5: InAppPurchaseButton! { 61 | didSet { 62 | let activeColor = UIColor(red: 141 / 255, green: 19 / 255, blue: 81 / 255, alpha: 1) 63 | let inactiveColor = UIColor(red: 89 / 255, green: 89 / 255, blue: 94 / 255, alpha: 1) 64 | 65 | inAppPurchaseButton5.attributedTextForInactiveState = generateAttributedString("$9.99", fontColor: .white) 66 | inAppPurchaseButton5.attributedTextForActiveState = generateAttributedString("Open", fontColor: .white) 67 | inAppPurchaseButton5.cornerRadiusForExpandedBorder = 0 68 | inAppPurchaseButton5.backgroundColorForInactiveState = inactiveColor 69 | inAppPurchaseButton5.backgroundColorForActiveState = activeColor 70 | inAppPurchaseButton5.borderColorForInactiveState = inactiveColor 71 | inAppPurchaseButton5.borderColorForActiveState = activeColor 72 | inAppPurchaseButton5.ringColorForProgressView = activeColor 73 | inAppPurchaseButton5.minExpandedSize = .zero 74 | inAppPurchaseButton5.prefferedTitleMargins = .zero 75 | inAppPurchaseButton5.widthForBusyView = 20 76 | } 77 | } 78 | 79 | // MARK: - Actions 80 | 81 | @IBAction func inAppPurchaseButton1Touched(_ sender: InAppPurchaseButton) { 82 | switch sender.buttonState { 83 | case .regular(animate: _, intermediateState: .inactive): 84 | sender.buttonState = .busy(animate: true) 85 | case .busy(animate: _): 86 | sender.buttonState = .downloading(progress: 0.25) 87 | case .downloading(progress: 0.25): 88 | sender.buttonState = .downloading(progress: 0.5) 89 | case .downloading(progress: 0.5): 90 | sender.buttonState = .downloading(progress: 0.75) 91 | case .downloading(progress: 0.75): 92 | sender.buttonState = .downloading(progress: 1) 93 | case .downloading(progress: _): 94 | sender.buttonState = .regular(animate: true, intermediateState: .active) 95 | case .regular(animate: _, intermediateState: .active): 96 | sender.buttonState = .regular(animate: false, intermediateState: .inactive) 97 | } 98 | } 99 | 100 | // MARK: - Helpers 101 | 102 | func generateAttributedString(_ string: String, fontColor: UIColor = .white) -> NSAttributedString { 103 | let paragraphStyle = NSMutableParagraphStyle() 104 | paragraphStyle.alignment = .center 105 | return NSAttributedString(string: string, attributes: [NSAttributedString.Key.font: UIFont(name: "Helvetica", size: 17)!, NSAttributedString.Key.foregroundColor: fontColor, NSAttributedString.Key.paragraphStyle: paragraphStyle]) 106 | } 107 | 108 | var defaultInactiveColor: UIColor { 109 | return UIColor(red: 198 / 255, green: 107 / 255, blue: 160 / 255, alpha: 1) 110 | } 111 | 112 | var defaultActiveColor: UIColor { 113 | return UIColor(red: 129 / 255, green: 209 / 255, blue: 216 / 255, alpha: 1) 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /tvOS Example/tvOS Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9ACB2656221ED482004C7CDB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ACB2655221ED482004C7CDB /* AppDelegate.swift */; }; 11 | 9ACB265B221ED482004C7CDB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9ACB2659221ED482004C7CDB /* Main.storyboard */; }; 12 | 9ACB265D221ED485004C7CDB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9ACB265C221ED485004C7CDB /* Assets.xcassets */; }; 13 | 9ACB2668221ED485004C7CDB /* tvOS_ExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ACB2667221ED485004C7CDB /* tvOS_ExampleUITests.swift */; }; 14 | 9ACB2673221ED4F6004C7CDB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ACB2672221ED4F6004C7CDB /* ViewController.swift */; }; 15 | 9ACB2684221ED6C1004C7CDB /* InAppPurchaseButton.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9ACB267D221ED696004C7CDB /* InAppPurchaseButton.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXContainerItemProxy section */ 19 | 9ACB2664221ED485004C7CDB /* PBXContainerItemProxy */ = { 20 | isa = PBXContainerItemProxy; 21 | containerPortal = 9ACB264A221ED482004C7CDB /* Project object */; 22 | proxyType = 1; 23 | remoteGlobalIDString = 9ACB2651221ED482004C7CDB; 24 | remoteInfo = "tvOS Example"; 25 | }; 26 | 9ACB267A221ED696004C7CDB /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 9ACB2674221ED696004C7CDB /* InAppPurchaseButton.xcodeproj */; 29 | proxyType = 2; 30 | remoteGlobalIDString = 48B973341CDB44710015E695; 31 | remoteInfo = "InAppPurchaseButton iOS"; 32 | }; 33 | 9ACB267C221ED696004C7CDB /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 9ACB2674221ED696004C7CDB /* InAppPurchaseButton.xcodeproj */; 36 | proxyType = 2; 37 | remoteGlobalIDString = 9ACB2631221ED0C7004C7CDB; 38 | remoteInfo = "InAppPurchaseButton tvOS"; 39 | }; 40 | 9ACB267E221ED696004C7CDB /* PBXContainerItemProxy */ = { 41 | isa = PBXContainerItemProxy; 42 | containerPortal = 9ACB2674221ED696004C7CDB /* InAppPurchaseButton.xcodeproj */; 43 | proxyType = 2; 44 | remoteGlobalIDString = 48AF07CA1D65ED49009E9CBF; 45 | remoteInfo = InAppPurchaseButtonTests; 46 | }; 47 | 9ACB2680221ED6A2004C7CDB /* PBXContainerItemProxy */ = { 48 | isa = PBXContainerItemProxy; 49 | containerPortal = 9ACB2674221ED696004C7CDB /* InAppPurchaseButton.xcodeproj */; 50 | proxyType = 1; 51 | remoteGlobalIDString = 9ACB2630221ED0C7004C7CDB; 52 | remoteInfo = "InAppPurchaseButton tvOS"; 53 | }; 54 | /* End PBXContainerItemProxy section */ 55 | 56 | /* Begin PBXCopyFilesBuildPhase section */ 57 | 9ACB2683221ED6B7004C7CDB /* CopyFiles */ = { 58 | isa = PBXCopyFilesBuildPhase; 59 | buildActionMask = 2147483647; 60 | dstPath = ""; 61 | dstSubfolderSpec = 10; 62 | files = ( 63 | 9ACB2684221ED6C1004C7CDB /* InAppPurchaseButton.framework in CopyFiles */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXCopyFilesBuildPhase section */ 68 | 69 | /* Begin PBXFileReference section */ 70 | 9ACB2652221ED482004C7CDB /* tvOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "tvOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 71 | 9ACB2655221ED482004C7CDB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 72 | 9ACB265A221ED482004C7CDB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 73 | 9ACB265C221ED485004C7CDB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 74 | 9ACB265E221ED485004C7CDB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 75 | 9ACB2663221ED485004C7CDB /* tvOS ExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "tvOS ExampleUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 76 | 9ACB2667221ED485004C7CDB /* tvOS_ExampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = tvOS_ExampleUITests.swift; sourceTree = ""; }; 77 | 9ACB2669221ED485004C7CDB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 78 | 9ACB2672221ED4F6004C7CDB /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 79 | 9ACB2674221ED696004C7CDB /* InAppPurchaseButton.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = InAppPurchaseButton.xcodeproj; path = ../InAppPurchaseButton.xcodeproj; sourceTree = ""; }; 80 | /* End PBXFileReference section */ 81 | 82 | /* Begin PBXFrameworksBuildPhase section */ 83 | 9ACB264F221ED482004C7CDB /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | 9ACB2660221ED485004C7CDB /* Frameworks */ = { 91 | isa = PBXFrameworksBuildPhase; 92 | buildActionMask = 2147483647; 93 | files = ( 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXFrameworksBuildPhase section */ 98 | 99 | /* Begin PBXGroup section */ 100 | 9ACB2649221ED482004C7CDB = { 101 | isa = PBXGroup; 102 | children = ( 103 | 9ACB2654221ED482004C7CDB /* tvOS Example */, 104 | 9ACB2666221ED485004C7CDB /* tvOS ExampleUITests */, 105 | 9ACB2653221ED482004C7CDB /* Products */, 106 | 9ACB2674221ED696004C7CDB /* InAppPurchaseButton.xcodeproj */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | 9ACB2653221ED482004C7CDB /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 9ACB2652221ED482004C7CDB /* tvOS Example.app */, 114 | 9ACB2663221ED485004C7CDB /* tvOS ExampleUITests.xctest */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | 9ACB2654221ED482004C7CDB /* tvOS Example */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 9ACB2655221ED482004C7CDB /* AppDelegate.swift */, 123 | 9ACB2672221ED4F6004C7CDB /* ViewController.swift */, 124 | 9ACB2659221ED482004C7CDB /* Main.storyboard */, 125 | 9ACB265C221ED485004C7CDB /* Assets.xcassets */, 126 | 9ACB265E221ED485004C7CDB /* Info.plist */, 127 | ); 128 | path = "tvOS Example"; 129 | sourceTree = ""; 130 | }; 131 | 9ACB2666221ED485004C7CDB /* tvOS ExampleUITests */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 9ACB2667221ED485004C7CDB /* tvOS_ExampleUITests.swift */, 135 | 9ACB2669221ED485004C7CDB /* Info.plist */, 136 | ); 137 | path = "tvOS ExampleUITests"; 138 | sourceTree = ""; 139 | }; 140 | 9ACB2675221ED696004C7CDB /* Products */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 9ACB267B221ED696004C7CDB /* InAppPurchaseButton.framework */, 144 | 9ACB267D221ED696004C7CDB /* InAppPurchaseButton.framework */, 145 | 9ACB267F221ED696004C7CDB /* InAppPurchaseButtonTests.xctest */, 146 | ); 147 | name = Products; 148 | sourceTree = ""; 149 | }; 150 | /* End PBXGroup section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | 9ACB2651221ED482004C7CDB /* tvOS Example */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = 9ACB266C221ED485004C7CDB /* Build configuration list for PBXNativeTarget "tvOS Example" */; 156 | buildPhases = ( 157 | 9ACB264E221ED482004C7CDB /* Sources */, 158 | 9ACB264F221ED482004C7CDB /* Frameworks */, 159 | 9ACB2650221ED482004C7CDB /* Resources */, 160 | 9ACB2683221ED6B7004C7CDB /* CopyFiles */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | 9ACB2681221ED6A2004C7CDB /* PBXTargetDependency */, 166 | ); 167 | name = "tvOS Example"; 168 | productName = "tvOS Example"; 169 | productReference = 9ACB2652221ED482004C7CDB /* tvOS Example.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | 9ACB2662221ED485004C7CDB /* tvOS ExampleUITests */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 9ACB266F221ED485004C7CDB /* Build configuration list for PBXNativeTarget "tvOS ExampleUITests" */; 175 | buildPhases = ( 176 | 9ACB265F221ED485004C7CDB /* Sources */, 177 | 9ACB2660221ED485004C7CDB /* Frameworks */, 178 | 9ACB2661221ED485004C7CDB /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | 9ACB2665221ED485004C7CDB /* PBXTargetDependency */, 184 | ); 185 | name = "tvOS ExampleUITests"; 186 | productName = "tvOS ExampleUITests"; 187 | productReference = 9ACB2663221ED485004C7CDB /* tvOS ExampleUITests.xctest */; 188 | productType = "com.apple.product-type.bundle.ui-testing"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 9ACB264A221ED482004C7CDB /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastSwiftUpdateCheck = 1010; 197 | LastUpgradeCheck = 1200; 198 | ORGANIZATIONNAME = InAppPurchaseButton; 199 | TargetAttributes = { 200 | 9ACB2651221ED482004C7CDB = { 201 | CreatedOnToolsVersion = 10.1; 202 | LastSwiftMigration = 1200; 203 | }; 204 | 9ACB2662221ED485004C7CDB = { 205 | CreatedOnToolsVersion = 10.1; 206 | LastSwiftMigration = 1200; 207 | TestTargetID = 9ACB2651221ED482004C7CDB; 208 | }; 209 | }; 210 | }; 211 | buildConfigurationList = 9ACB264D221ED482004C7CDB /* Build configuration list for PBXProject "tvOS Example" */; 212 | compatibilityVersion = "Xcode 9.3"; 213 | developmentRegion = en; 214 | hasScannedForEncodings = 0; 215 | knownRegions = ( 216 | en, 217 | Base, 218 | ); 219 | mainGroup = 9ACB2649221ED482004C7CDB; 220 | productRefGroup = 9ACB2653221ED482004C7CDB /* Products */; 221 | projectDirPath = ""; 222 | projectReferences = ( 223 | { 224 | ProductGroup = 9ACB2675221ED696004C7CDB /* Products */; 225 | ProjectRef = 9ACB2674221ED696004C7CDB /* InAppPurchaseButton.xcodeproj */; 226 | }, 227 | ); 228 | projectRoot = ""; 229 | targets = ( 230 | 9ACB2651221ED482004C7CDB /* tvOS Example */, 231 | 9ACB2662221ED485004C7CDB /* tvOS ExampleUITests */, 232 | ); 233 | }; 234 | /* End PBXProject section */ 235 | 236 | /* Begin PBXReferenceProxy section */ 237 | 9ACB267B221ED696004C7CDB /* InAppPurchaseButton.framework */ = { 238 | isa = PBXReferenceProxy; 239 | fileType = wrapper.framework; 240 | path = InAppPurchaseButton.framework; 241 | remoteRef = 9ACB267A221ED696004C7CDB /* PBXContainerItemProxy */; 242 | sourceTree = BUILT_PRODUCTS_DIR; 243 | }; 244 | 9ACB267D221ED696004C7CDB /* InAppPurchaseButton.framework */ = { 245 | isa = PBXReferenceProxy; 246 | fileType = wrapper.framework; 247 | path = InAppPurchaseButton.framework; 248 | remoteRef = 9ACB267C221ED696004C7CDB /* PBXContainerItemProxy */; 249 | sourceTree = BUILT_PRODUCTS_DIR; 250 | }; 251 | 9ACB267F221ED696004C7CDB /* InAppPurchaseButtonTests.xctest */ = { 252 | isa = PBXReferenceProxy; 253 | fileType = wrapper.cfbundle; 254 | path = InAppPurchaseButtonTests.xctest; 255 | remoteRef = 9ACB267E221ED696004C7CDB /* PBXContainerItemProxy */; 256 | sourceTree = BUILT_PRODUCTS_DIR; 257 | }; 258 | /* End PBXReferenceProxy section */ 259 | 260 | /* Begin PBXResourcesBuildPhase section */ 261 | 9ACB2650221ED482004C7CDB /* Resources */ = { 262 | isa = PBXResourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | 9ACB265D221ED485004C7CDB /* Assets.xcassets in Resources */, 266 | 9ACB265B221ED482004C7CDB /* Main.storyboard in Resources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | 9ACB2661221ED485004C7CDB /* Resources */ = { 271 | isa = PBXResourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | }; 277 | /* End PBXResourcesBuildPhase section */ 278 | 279 | /* Begin PBXSourcesBuildPhase section */ 280 | 9ACB264E221ED482004C7CDB /* Sources */ = { 281 | isa = PBXSourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | 9ACB2673221ED4F6004C7CDB /* ViewController.swift in Sources */, 285 | 9ACB2656221ED482004C7CDB /* AppDelegate.swift in Sources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | 9ACB265F221ED485004C7CDB /* Sources */ = { 290 | isa = PBXSourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | 9ACB2668221ED485004C7CDB /* tvOS_ExampleUITests.swift in Sources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | /* End PBXSourcesBuildPhase section */ 298 | 299 | /* Begin PBXTargetDependency section */ 300 | 9ACB2665221ED485004C7CDB /* PBXTargetDependency */ = { 301 | isa = PBXTargetDependency; 302 | target = 9ACB2651221ED482004C7CDB /* tvOS Example */; 303 | targetProxy = 9ACB2664221ED485004C7CDB /* PBXContainerItemProxy */; 304 | }; 305 | 9ACB2681221ED6A2004C7CDB /* PBXTargetDependency */ = { 306 | isa = PBXTargetDependency; 307 | name = "InAppPurchaseButton tvOS"; 308 | targetProxy = 9ACB2680221ED6A2004C7CDB /* PBXContainerItemProxy */; 309 | }; 310 | /* End PBXTargetDependency section */ 311 | 312 | /* Begin PBXVariantGroup section */ 313 | 9ACB2659221ED482004C7CDB /* Main.storyboard */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | 9ACB265A221ED482004C7CDB /* Base */, 317 | ); 318 | name = Main.storyboard; 319 | sourceTree = ""; 320 | }; 321 | /* End PBXVariantGroup section */ 322 | 323 | /* Begin XCBuildConfiguration section */ 324 | 9ACB266A221ED485004C7CDB /* Debug */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_ANALYZER_NONNULL = YES; 329 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_ENABLE_OBJC_WEAK = YES; 335 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 336 | CLANG_WARN_BOOL_CONVERSION = YES; 337 | CLANG_WARN_COMMA = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 340 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 341 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 342 | CLANG_WARN_EMPTY_BODY = YES; 343 | CLANG_WARN_ENUM_CONVERSION = YES; 344 | CLANG_WARN_INFINITE_RECURSION = YES; 345 | CLANG_WARN_INT_CONVERSION = YES; 346 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 347 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 348 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 349 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 350 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 351 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 352 | CLANG_WARN_STRICT_PROTOTYPES = YES; 353 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 354 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 355 | CLANG_WARN_UNREACHABLE_CODE = YES; 356 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 357 | COPY_PHASE_STRIP = NO; 358 | DEBUG_INFORMATION_FORMAT = dwarf; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | ENABLE_TESTABILITY = YES; 361 | GCC_C_LANGUAGE_STANDARD = gnu11; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_OPTIMIZATION_LEVEL = 0; 365 | GCC_PREPROCESSOR_DEFINITIONS = ( 366 | "DEBUG=1", 367 | "$(inherited)", 368 | ); 369 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 370 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 371 | GCC_WARN_UNDECLARED_SELECTOR = YES; 372 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 373 | GCC_WARN_UNUSED_FUNCTION = YES; 374 | GCC_WARN_UNUSED_VARIABLE = YES; 375 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 376 | MTL_FAST_MATH = YES; 377 | ONLY_ACTIVE_ARCH = YES; 378 | SDKROOT = appletvos; 379 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 380 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 381 | TVOS_DEPLOYMENT_TARGET = 12.1; 382 | }; 383 | name = Debug; 384 | }; 385 | 9ACB266B221ED485004C7CDB /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | ALWAYS_SEARCH_USER_PATHS = NO; 389 | CLANG_ANALYZER_NONNULL = YES; 390 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 392 | CLANG_CXX_LIBRARY = "libc++"; 393 | CLANG_ENABLE_MODULES = YES; 394 | CLANG_ENABLE_OBJC_ARC = YES; 395 | CLANG_ENABLE_OBJC_WEAK = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 401 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 402 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 403 | CLANG_WARN_EMPTY_BODY = YES; 404 | CLANG_WARN_ENUM_CONVERSION = YES; 405 | CLANG_WARN_INFINITE_RECURSION = YES; 406 | CLANG_WARN_INT_CONVERSION = YES; 407 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 409 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 416 | CLANG_WARN_UNREACHABLE_CODE = YES; 417 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu11; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | MTL_ENABLE_DEBUG_INFO = NO; 431 | MTL_FAST_MATH = YES; 432 | SDKROOT = appletvos; 433 | SWIFT_COMPILATION_MODE = wholemodule; 434 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 435 | TVOS_DEPLOYMENT_TARGET = 12.1; 436 | VALIDATE_PRODUCT = YES; 437 | }; 438 | name = Release; 439 | }; 440 | 9ACB266D221ED485004C7CDB /* Debug */ = { 441 | isa = XCBuildConfiguration; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 444 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 445 | CODE_SIGN_STYLE = Automatic; 446 | DEVELOPMENT_TEAM = 2A46D7V85T; 447 | INFOPLIST_FILE = "tvOS Example/Info.plist"; 448 | LD_RUNPATH_SEARCH_PATHS = ( 449 | "$(inherited)", 450 | "@executable_path/Frameworks", 451 | ); 452 | PRODUCT_BUNDLE_IDENTIFIER = "com.inapppurchasebutton.tvOS-Example"; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | SWIFT_VERSION = 5.0; 455 | TARGETED_DEVICE_FAMILY = 3; 456 | }; 457 | name = Debug; 458 | }; 459 | 9ACB266E221ED485004C7CDB /* Release */ = { 460 | isa = XCBuildConfiguration; 461 | buildSettings = { 462 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 463 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 464 | CODE_SIGN_STYLE = Automatic; 465 | DEVELOPMENT_TEAM = 2A46D7V85T; 466 | INFOPLIST_FILE = "tvOS Example/Info.plist"; 467 | LD_RUNPATH_SEARCH_PATHS = ( 468 | "$(inherited)", 469 | "@executable_path/Frameworks", 470 | ); 471 | PRODUCT_BUNDLE_IDENTIFIER = "com.inapppurchasebutton.tvOS-Example"; 472 | PRODUCT_NAME = "$(TARGET_NAME)"; 473 | SWIFT_VERSION = 5.0; 474 | TARGETED_DEVICE_FAMILY = 3; 475 | }; 476 | name = Release; 477 | }; 478 | 9ACB2670221ED485004C7CDB /* Debug */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 482 | CODE_SIGN_STYLE = Automatic; 483 | DEVELOPMENT_TEAM = 2A46D7V85T; 484 | INFOPLIST_FILE = "tvOS ExampleUITests/Info.plist"; 485 | LD_RUNPATH_SEARCH_PATHS = ( 486 | "$(inherited)", 487 | "@executable_path/Frameworks", 488 | "@loader_path/Frameworks", 489 | ); 490 | PRODUCT_BUNDLE_IDENTIFIER = "com.inapppurchasebutton.tvOS-ExampleUITests"; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | SWIFT_VERSION = 5.0; 493 | TARGETED_DEVICE_FAMILY = 3; 494 | TEST_TARGET_NAME = "tvOS Example"; 495 | }; 496 | name = Debug; 497 | }; 498 | 9ACB2671221ED485004C7CDB /* Release */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 502 | CODE_SIGN_STYLE = Automatic; 503 | DEVELOPMENT_TEAM = 2A46D7V85T; 504 | INFOPLIST_FILE = "tvOS ExampleUITests/Info.plist"; 505 | LD_RUNPATH_SEARCH_PATHS = ( 506 | "$(inherited)", 507 | "@executable_path/Frameworks", 508 | "@loader_path/Frameworks", 509 | ); 510 | PRODUCT_BUNDLE_IDENTIFIER = "com.inapppurchasebutton.tvOS-ExampleUITests"; 511 | PRODUCT_NAME = "$(TARGET_NAME)"; 512 | SWIFT_VERSION = 5.0; 513 | TARGETED_DEVICE_FAMILY = 3; 514 | TEST_TARGET_NAME = "tvOS Example"; 515 | }; 516 | name = Release; 517 | }; 518 | /* End XCBuildConfiguration section */ 519 | 520 | /* Begin XCConfigurationList section */ 521 | 9ACB264D221ED482004C7CDB /* Build configuration list for PBXProject "tvOS Example" */ = { 522 | isa = XCConfigurationList; 523 | buildConfigurations = ( 524 | 9ACB266A221ED485004C7CDB /* Debug */, 525 | 9ACB266B221ED485004C7CDB /* Release */, 526 | ); 527 | defaultConfigurationIsVisible = 0; 528 | defaultConfigurationName = Release; 529 | }; 530 | 9ACB266C221ED485004C7CDB /* Build configuration list for PBXNativeTarget "tvOS Example" */ = { 531 | isa = XCConfigurationList; 532 | buildConfigurations = ( 533 | 9ACB266D221ED485004C7CDB /* Debug */, 534 | 9ACB266E221ED485004C7CDB /* Release */, 535 | ); 536 | defaultConfigurationIsVisible = 0; 537 | defaultConfigurationName = Release; 538 | }; 539 | 9ACB266F221ED485004C7CDB /* Build configuration list for PBXNativeTarget "tvOS ExampleUITests" */ = { 540 | isa = XCConfigurationList; 541 | buildConfigurations = ( 542 | 9ACB2670221ED485004C7CDB /* Debug */, 543 | 9ACB2671221ED485004C7CDB /* Release */, 544 | ); 545 | defaultConfigurationIsVisible = 0; 546 | defaultConfigurationName = Release; 547 | }; 548 | /* End XCConfigurationList section */ 549 | }; 550 | rootObject = 9ACB264A221ED482004C7CDB /* Project object */; 551 | } 552 | -------------------------------------------------------------------------------- /tvOS Example/tvOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tvOS Example/tvOS Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tvOS Example/tvOS Example.xcodeproj/xcshareddata/xcschemes/tvOS Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 64 | 70 | 71 | 72 | 73 | 79 | 81 | 87 | 88 | 89 | 90 | 92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // tvOS Example 4 | // 5 | // Created by Luke Durrant on 21/2/19. 6 | // Copyright © 2019 InAppPurchaseButton. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv" 5 | } 6 | ], 7 | "info" : { 8 | "version" : 1, 9 | "author" : "xcode" 10 | } 11 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers" : [ 3 | { 4 | "filename" : "Front.imagestacklayer" 5 | }, 6 | { 7 | "filename" : "Middle.imagestacklayer" 8 | }, 9 | { 10 | "filename" : "Back.imagestacklayer" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv" 5 | } 6 | ], 7 | "info" : { 8 | "version" : 1, 9 | "author" : "xcode" 10 | } 11 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv" 5 | } 6 | ], 7 | "info" : { 8 | "version" : 1, 9 | "author" : "xcode" 10 | } 11 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "version" : 1, 14 | "author" : "xcode" 15 | } 16 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers" : [ 3 | { 4 | "filename" : "Front.imagestacklayer" 5 | }, 6 | { 7 | "filename" : "Middle.imagestacklayer" 8 | }, 9 | { 10 | "filename" : "Back.imagestacklayer" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "version" : 1, 14 | "author" : "xcode" 15 | } 16 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "version" : 1, 14 | "author" : "xcode" 15 | } 16 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "assets" : [ 3 | { 4 | "size" : "1280x768", 5 | "idiom" : "tv", 6 | "filename" : "App Icon - App Store.imagestack", 7 | "role" : "primary-app-icon" 8 | }, 9 | { 10 | "size" : "400x240", 11 | "idiom" : "tv", 12 | "filename" : "App Icon.imagestack", 13 | "role" : "primary-app-icon" 14 | }, 15 | { 16 | "size" : "2320x720", 17 | "idiom" : "tv", 18 | "filename" : "Top Shelf Image Wide.imageset", 19 | "role" : "top-shelf-image-wide" 20 | }, 21 | { 22 | "size" : "1920x720", 23 | "idiom" : "tv", 24 | "filename" : "Top Shelf Image.imageset", 25 | "role" : "top-shelf-image" 26 | } 27 | ], 28 | "info" : { 29 | "version" : 1, 30 | "author" : "xcode" 31 | } 32 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "tv-marketing", 13 | "scale" : "1x" 14 | }, 15 | { 16 | "idiom" : "tv-marketing", 17 | "scale" : "2x" 18 | } 19 | ], 20 | "info" : { 21 | "version" : 1, 22 | "author" : "xcode" 23 | } 24 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "tv-marketing", 13 | "scale" : "1x" 14 | }, 15 | { 16 | "idiom" : "tv-marketing", 17 | "scale" : "2x" 18 | } 19 | ], 20 | "info" : { 21 | "version" : 1, 22 | "author" : "xcode" 23 | } 24 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Assets.xcassets/Launch Image.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "landscape", 5 | "idiom" : "tv", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "11.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "tv", 13 | "extent" : "full-screen", 14 | "minimum-system-version" : "9.0", 15 | "scale" : "1x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 33 | 41 | 49 | 57 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIMainStoryboardFile 24 | Main 25 | UIRequiredDeviceCapabilities 26 | 27 | arm64 28 | 29 | UIUserInterfaceStyle 30 | Automatic 31 | 32 | 33 | -------------------------------------------------------------------------------- /tvOS Example/tvOS Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // iOS Example 4 | // 5 | // Created by Pawel Kania on 06/05/16. 6 | // Copyright © 2016 PGS Software. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import InAppPurchaseButton 11 | 12 | class ViewController: UIViewController { 13 | 14 | // MARK: - Outlets 15 | 16 | @IBOutlet weak var inAppPurchaseButton1: InAppPurchaseButton! { 17 | didSet { 18 | inAppPurchaseButton1.attributedTextForInactiveState = generateAttributedString("$1.99", fontColor: .white) 19 | inAppPurchaseButton1.attributedTextForActiveState = generateAttributedString("Open", fontColor: .white) 20 | inAppPurchaseButton1.imageForInactiveState = UIImage(named: "pinkbutton") 21 | inAppPurchaseButton1.imageForActiveState = UIImage(named: "bluebutton") 22 | inAppPurchaseButton1.attributedTextForProgressView = generateAttributedString("⇣", fontColor: defaultActiveColor) 23 | } 24 | } 25 | @IBOutlet weak var inAppPurchaseButton2: InAppPurchaseButton! { 26 | didSet { 27 | inAppPurchaseButton2.attributedTextForInactiveState = generateAttributedString("$0.99", fontColor: defaultInactiveColor) 28 | inAppPurchaseButton2.attributedTextForActiveState = generateAttributedString("Open", fontColor: defaultActiveColor) 29 | inAppPurchaseButton2.cornerRadiusForExpandedBorder = 8 30 | inAppPurchaseButton2.borderWidthForProgressView = 4 31 | inAppPurchaseButton2.shouldAlwaysDisplayBorder = true 32 | } 33 | } 34 | @IBOutlet weak var inAppPurchaseButton3: InAppPurchaseButton! { 35 | didSet { 36 | inAppPurchaseButton3.attributedTextForInactiveState = generateAttributedString("$4.99", fontColor: .white) 37 | inAppPurchaseButton3.attributedTextForActiveState = generateAttributedString("Open", fontColor: .white) 38 | inAppPurchaseButton3.cornerRadiusForExpandedBorder = 10 39 | inAppPurchaseButton3.borderWidthForProgressView = 3 40 | inAppPurchaseButton3.backgroundColorForInactiveState = defaultInactiveColor 41 | inAppPurchaseButton3.backgroundColorForActiveState = defaultActiveColor 42 | inAppPurchaseButton3.attributedTextForProgressView = generateAttributedString("◼︎", fontColor: defaultActiveColor) 43 | } 44 | } 45 | @IBOutlet weak var inAppPurchaseButton4: InAppPurchaseButton! { 46 | didSet { 47 | let activeColor = UIColor(red: 130 / 255, green: 184 / 255, blue: 59 / 255, alpha: 1) 48 | let inactiveColor = UIColor(red: 89 / 255, green: 116 / 255, blue: 146 / 255, alpha: 1) 49 | 50 | inAppPurchaseButton4.attributedTextForInactiveState = generateAttributedString("$6.99", fontColor: .white) 51 | inAppPurchaseButton4.attributedTextForActiveState = generateAttributedString("Open", fontColor: .white) 52 | inAppPurchaseButton4.backgroundColorForInactiveState = inactiveColor 53 | inAppPurchaseButton4.backgroundColorForActiveState = activeColor 54 | inAppPurchaseButton4.borderColorForInactiveState = inactiveColor 55 | inAppPurchaseButton4.borderColorForActiveState = activeColor 56 | inAppPurchaseButton4.ringColorForProgressView = activeColor 57 | inAppPurchaseButton4.indicatorImageForProgressMode = UIImage(named: "progress-indicator") 58 | } 59 | } 60 | @IBOutlet weak var inAppPurchaseButton5: InAppPurchaseButton! { 61 | didSet { 62 | let activeColor = UIColor(red: 141 / 255, green: 19 / 255, blue: 81 / 255, alpha: 1) 63 | let inactiveColor = UIColor(red: 89 / 255, green: 89 / 255, blue: 94 / 255, alpha: 1) 64 | 65 | inAppPurchaseButton5.attributedTextForInactiveState = generateAttributedString("$9.99", fontColor: .white) 66 | inAppPurchaseButton5.attributedTextForActiveState = generateAttributedString("Open", fontColor: .white) 67 | inAppPurchaseButton5.cornerRadiusForExpandedBorder = 0 68 | inAppPurchaseButton5.backgroundColorForInactiveState = inactiveColor 69 | inAppPurchaseButton5.backgroundColorForActiveState = activeColor 70 | inAppPurchaseButton5.borderColorForInactiveState = inactiveColor 71 | inAppPurchaseButton5.borderColorForActiveState = activeColor 72 | inAppPurchaseButton5.ringColorForProgressView = activeColor 73 | inAppPurchaseButton5.minExpandedSize = .zero 74 | inAppPurchaseButton5.prefferedTitleMargins = .zero 75 | inAppPurchaseButton5.widthForBusyView = 20 76 | } 77 | } 78 | 79 | // MARK: - Actions 80 | 81 | @IBAction func inAppPurchaseButton1Touched(_ sender: InAppPurchaseButton) { 82 | switch sender.buttonState { 83 | case .regular(animate: _, intermediateState: .inactive): 84 | sender.buttonState = .busy(animate: true) 85 | case .busy(animate: _): 86 | sender.buttonState = .downloading(progress: 0.25) 87 | case .downloading(progress: 0.25): 88 | sender.buttonState = .downloading(progress: 0.5) 89 | case .downloading(progress: 0.5): 90 | sender.buttonState = .downloading(progress: 0.75) 91 | case .downloading(progress: 0.75): 92 | sender.buttonState = .downloading(progress: 1) 93 | case .downloading(progress: _): 94 | sender.buttonState = .regular(animate: true, intermediateState: .active) 95 | case .regular(animate: _, intermediateState: .active): 96 | sender.buttonState = .regular(animate: false, intermediateState: .inactive) 97 | } 98 | } 99 | 100 | // MARK: - Helpers 101 | 102 | func generateAttributedString(_ string: String, fontColor: UIColor = .white) -> NSAttributedString { 103 | let paragraphStyle = NSMutableParagraphStyle() 104 | paragraphStyle.alignment = .center 105 | return NSAttributedString(string: string, attributes: [NSAttributedString.Key.font: UIFont(name: "Helvetica", size: 17)!, NSAttributedString.Key.foregroundColor: fontColor, NSAttributedString.Key.paragraphStyle: paragraphStyle]) 106 | } 107 | 108 | var defaultInactiveColor: UIColor { 109 | return UIColor(red: 198 / 255, green: 107 / 255, blue: 160 / 255, alpha: 1) 110 | } 111 | 112 | var defaultActiveColor: UIColor { 113 | return UIColor(red: 129 / 255, green: 209 / 255, blue: 216 / 255, alpha: 1) 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /tvOS Example/tvOS ExampleUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /tvOS Example/tvOS ExampleUITests/tvOS_ExampleUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // tvOS_ExampleUITests.swift 3 | // tvOS ExampleUITests 4 | // 5 | // Created by Luke Durrant on 21/2/19. 6 | // Copyright © 2019 InAppPurchaseButton. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class tvOS_ExampleUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 20 | XCUIApplication().launch() 21 | 22 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 23 | } 24 | 25 | override func tearDown() { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | } 28 | 29 | func testExample() { 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | } 35 | --------------------------------------------------------------------------------