├── .gitignore ├── LICENSE ├── README.md ├── README_zh_CN.md ├── SwiftPhotoApp.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── SwiftPhotoApp ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist └── ViewController.swift ├── SwiftPhotoAppTests ├── Info.plist └── SwiftPhAppTests.swift ├── SwiftPhotoAppUITests ├── Info.plist └── SwiftPhAppUITests.swift └── docs └── screenshots ├── infoplst1.01.png ├── minio-SWIFT1.jpg ├── minio-SWIFT3.jpg ├── minio-SWIFT5.jpg ├── projectTemplate1.01.png └── storyBoard1.01.png /.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 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 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/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/screenshots 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Swift Photo App [![Slack](https://slack.minio.io/slack?type=svg)](https://slack.minio.io) 2 | 3 | ![minio_SWIFT1](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/minio-SWIFT1.jpg?raw=true) 4 | 5 | This example will guide you through the code to build a simple Swift Photo app. In this app, you will learn how a Swift client can use the Photo API Service and load a random image. Full code is available here: https://github.com/minio/swift-photo-app, released under Apache 2.0 License. 6 | 7 | ## 1. Dependencies 8 | 9 | We will be building this app using Xcode 7.0 with Swift 2.0. This app will also consume the Photo API Service we built to get presigned urls that are randomly loaded on click of a button. 10 | 11 | * Xcode 8.3 Beta 12 | * Swift 3.1 13 | 14 | ## 2. SetUp 15 | 16 | Launch Xcode and complete the following steps. 17 | 18 | * Step 1 - Create a new Project. Select Single View Application as shown below and click Next. 19 | 20 | 21 | ![minio_SWIFT2](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/projectTemplate1.01.png?raw=true) 22 | 23 | 24 | * Step 2 - Fill in the Project Name and Organization Name and Identifiers. We have used the below in this example, feel free to customize it to your own needs. Click Next. 25 | 26 | 27 | ![minio_SWIFT3](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/minio-SWIFT3.jpg?raw=true) 28 | 29 | 30 | * Step 3 - Now you have an empty MainStoryBoard that is ready to be worked on. 31 | 32 | ![minio_SWIFT4](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/storyBoard1.01.png?raw=true) 33 | 34 | 35 | ## 3. MainStoryBoard 36 | 37 | * Let's drag and drop a UIButton to the StoryBoard. 38 | * Let's also drag and drop an imageView to the StoryBoard. 39 | * Feel free to change the background colors of the UIButton and UIView. 40 | 41 | ![minio_SWIFT5](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/minio-SWIFT5.jpg?raw=true) 42 | 43 | 44 | ## 4. ViewController.swift 45 | 46 | We will use the Photo API Service we built earlier to service the SwiftPhotoApp client. For the sake of simplicity, we will not use a TableView or a CollectionView to display all of the photos. Instead we will randomly load one of the photos from the presigned URLs we receive from the PhotoAPI Service. 47 | 48 | ```swift 49 | import UIKit 50 | 51 | class ViewController: UIViewController { 52 | 53 | @IBAction func refButton(sender: UIButton) { 54 | 55 | // Set up the URL Object. 56 | let url = URL(string: "http://play.minio.io:8080/PhotoAPIService-0.0.1-SNAPSHOT/minio/photoservice/list") 57 | 58 | // Task fetches the url contents asynchronously. 59 | let task = URLSession.shared.dataTask(with: url! as URL) {(data, response, error) in 60 | 61 | let httpResponse = response as! HTTPURLResponse 62 | let statusCode = httpResponse.statusCode 63 | 64 | // Process the response. 65 | if (statusCode == 200) { 66 | 67 | do{ 68 | // Get the json response. 69 | let json = try JSONSerialization.jsonObject(with: data!, options:.allowFragments) as! [String:AnyObject] 70 | 71 | // Extract the Album json into the albums array. 72 | if let albums = json["Album"] as? [[String: AnyObject]]{ 73 | 74 | // Pick a random index from the albums array. 75 | let randomIndex = Int(arc4random_uniform(UInt32(albums.count))) 76 | 77 | // Extract the url from the albums array using this random index we generated. 78 | let loadImageUrl:String = albums[randomIndex]["url"] as! String 79 | 80 | // Prepare the imageView. 81 | self.imageView.contentMode = .scaleAspectFit 82 | 83 | // Download and place the image in the image view with a helper function. 84 | if let checkedUrl = URL(string: loadImageUrl) { 85 | self.imageView.contentMode = .scaleAspectFit 86 | self.downloadImage(url: checkedUrl) 87 | } 88 | 89 | } 90 | } 91 | catch { 92 | print("Error with Json: \(error)") 93 | } 94 | } 95 | 96 | } 97 | 98 | task.resume() 99 | 100 | } 101 | 102 | @IBOutlet weak var imageView: UIImageView! 103 | override func viewDidLoad() { 104 | super.viewDidLoad() 105 | // Do any additional setup after loading the view, typically from a nib. 106 | } 107 | 108 | override func didReceiveMemoryWarning() { 109 | super.didReceiveMemoryWarning() 110 | // Dispose of any resources that can be recreated. 111 | } 112 | 113 | // Asynchronous helper function that fetches data from the PhotoAPIService. 114 | func getDataFromUrl(url:URL, completion: @escaping ((_ data: Data?, _ response: URLResponse?, _ error: Error? ) -> Void)) { 115 | URLSession.shared.dataTask(with: url as URL) { (data, response, error) in 116 | completion(data, response, error) 117 | }.resume() 118 | } 119 | 120 | // Helper function that download asynchronously an image from a given url. 121 | func downloadImage(url: URL){ 122 | getDataFromUrl(url: url) { (data, response, error) in 123 | DispatchQueue.main.async() { () -> Void in 124 | guard let data = data, error == nil else { return } 125 | self.imageView.image = UIImage(data: data as Data) 126 | } 127 | } 128 | } 129 | 130 | } 131 | 132 | ``` 133 | 134 | ## 5. Info.plist 135 | 136 | We need to add the permissions into our info.plist file so that the app can fetch the URLs & images from play. 137 | 138 | ![minio_SWIFT6](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/infoplst1.01.png?raw=true) 139 | 140 | 141 | Here's the full info.plist file if you prefer to see the xml version of the above changes. 142 | 143 | ```xml 144 | 145 | 146 | 147 | 148 | CFBundleDevelopmentRegion 149 | en 150 | CFBundleExecutable 151 | $(EXECUTABLE_NAME) 152 | CFBundleIdentifier 153 | $(PRODUCT_BUNDLE_IDENTIFIER) 154 | CFBundleInfoDictionaryVersion 155 | 6.0 156 | CFBundleName 157 | $(PRODUCT_NAME) 158 | CFBundlePackageType 159 | APPL 160 | CFBundleShortVersionString 161 | 1.0 162 | CFBundleSignature 163 | ???? 164 | CFBundleVersion 165 | 1 166 | LSRequiresIPhoneOS 167 | 168 | UILaunchStoryboardName 169 | LaunchScreen 170 | UIMainStoryboardFile 171 | Main 172 | UIRequiredDeviceCapabilities 173 | 174 | armv7 175 | 176 | UISupportedInterfaceOrientations 177 | 178 | UIInterfaceOrientationPortrait 179 | UIInterfaceOrientationLandscapeLeft 180 | UIInterfaceOrientationLandscapeRight 181 | 182 | 183 | NSAppTransportSecurity 184 | 185 | NSExceptionDomains 186 | 187 | play.minio.io 188 | 189 | NSIncludesSubdomains 190 | 191 | NSTemporaryExceptionAllowsInsecureHTTPLoads 192 | 193 | NSTemporaryExceptionMinimumTLSVersion 194 | 1.0 195 | NSTemporaryExceptionRequiresForwardSecrecy 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | ``` 204 | 205 | ## 7. Run the App 206 | 207 | * Launch the iOS Simulator. 208 | * Press the play button to run & deploy the app onto the simulator. 209 | * Click on the Load Random Image Button to load a different image overtime. 210 | 211 | ## 8. Explore Further 212 | 213 | - [Photo API Service Example](https://docs.minio.io/docs/java-photo-api-service) 214 | - [Using `minio-java`client SDK with Minio Server](https://docs.minio.io/docs/java-client-quickstart-guide) 215 | - [Minio Java Client SDK API Reference](https://docs.minio.io/docs/java-client-api-reference) 216 | -------------------------------------------------------------------------------- /README_zh_CN.md: -------------------------------------------------------------------------------- 1 | # Swift Photo App [![Slack](https://slack.minio.io/slack?type=svg)](https://slack.minio.io) 2 | 3 | ![minio_SWIFT1](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/minio-SWIFT1.jpg?raw=true) 4 | 5 | 本示例将会指导你使用Swift构建一个简单的Photo app。在这个app中,你将会学习一个Swift client是如何访问Photo API Service并随机加载一张图片。你可以通过[这里](https://github.com/minio/swift-photo-app)获取完整的代码,代码是以Apache 2.0 License发布的。 6 | 7 | ## 1. 依赖 8 | 9 | 我们将使用Xcode7.0和Swift2.0来构建这个app。这个app也会访问我们发布的Photo API Service来随机获获取一张图片的presigned url。 10 | 11 | * Xcode 8.3 Beta 12 | * Swift 3.1 13 | 14 | ## 2. 设置 15 | 16 | 启动Xcode并完成下列步骤。 17 | 18 | * 步骤1 - 创建一个新的工程,选择Single View Application,点击Next。 19 | 20 | 21 | ![minio_SWIFT2](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/projectTemplate1.01.png?raw=true) 22 | 23 | 24 | * 步骤2 - 输入Project Name,Organization Name和Identifiers。我们在本示例中用的是下图所示的值,你想改的话请便。点击Next。 25 | 26 | ![minio_SWIFT3](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/minio-SWIFT3.jpg?raw=true) 27 | 28 | 29 | * 步骤3 - 现在一个空的MainStoryBoard已经准备就绪。 30 | 31 | ![minio_SWIFT4](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/storyBoard1.01.png?raw=true) 32 | 33 | 34 | ## 3. MainStoryBoard 35 | 36 | * 拖拽一个UIButton到这个StoryBoard。 37 | * 拖拽一个imageView到这个StoryBoard。 38 | * 如果你不太喜欢它们的背景色的话,你可以改成你喜欢的颜色。 39 | 40 | ![minio_SWIFT5](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/minio-SWIFT5.jpg?raw=true) 41 | 42 | 43 | ## 4. ViewController.swift 44 | 45 | 我们将会用到之前构建的Phtoto API Service来给我们的SwiftPhotoApp提供服务。为了简单起见,我们没有用到TableView或者是CollectionView来显示图片列表,我们只是从PhotoAPI Service返回的多个presigned URL中随机选一个进行加载。 46 | 47 | ```swift 48 | import UIKit 49 | 50 | class ViewController: UIViewController { 51 | 52 | @IBAction func refButton(sender: UIButton) { 53 | 54 | // Set up the URL Object. 55 | let url = URL(string: "http://play.minio.io:8080/PhotoAPIService-0.0.1-SNAPSHOT/minio/photoservice/list") 56 | 57 | // Task fetches the url contents asynchronously. 58 | let task = URLSession.shared.dataTask(with: url! as URL) {(data, response, error) in 59 | 60 | let httpResponse = response as! HTTPURLResponse 61 | let statusCode = httpResponse.statusCode 62 | 63 | // Process the response. 64 | if (statusCode == 200) { 65 | 66 | do{ 67 | // Get the json response. 68 | let json = try JSONSerialization.jsonObject(with: data!, options:.allowFragments) as! [String:AnyObject] 69 | 70 | // Extract the Album json into the albums array. 71 | if let albums = json["Album"] as? [[String: AnyObject]]{ 72 | 73 | // Pick a random index from the albums array. 74 | let randomIndex = Int(arc4random_uniform(UInt32(albums.count))) 75 | 76 | // Extract the url from the albums array using this random index we generated. 77 | let loadImageUrl:String = albums[randomIndex]["url"] as! String 78 | 79 | // Prepare the imageView. 80 | self.imageView.contentMode = .scaleAspectFit 81 | 82 | // Download and place the image in the image view with a helper function. 83 | if let checkedUrl = URL(string: loadImageUrl) { 84 | self.imageView.contentMode = .scaleAspectFit 85 | self.downloadImage(url: checkedUrl) 86 | } 87 | 88 | } 89 | } 90 | catch { 91 | print("Error with Json: \(error)") 92 | } 93 | } 94 | 95 | } 96 | 97 | task.resume() 98 | 99 | } 100 | 101 | @IBOutlet weak var imageView: UIImageView! 102 | override func viewDidLoad() { 103 | super.viewDidLoad() 104 | // Do any additional setup after loading the view, typically from a nib. 105 | } 106 | 107 | override func didReceiveMemoryWarning() { 108 | super.didReceiveMemoryWarning() 109 | // Dispose of any resources that can be recreated. 110 | } 111 | 112 | // Asynchronous helper function that fetches data from the PhotoAPIService. 113 | func getDataFromUrl(url:URL, completion: @escaping ((_ data: Data?, _ response: URLResponse?, _ error: Error? ) -> Void)) { 114 | URLSession.shared.dataTask(with: url as URL) { (data, response, error) in 115 | completion(data, response, error) 116 | }.resume() 117 | } 118 | 119 | // Helper function that download asynchronously an image from a given url. 120 | func downloadImage(url: URL){ 121 | getDataFromUrl(url: url) { (data, response, error) in 122 | DispatchQueue.main.async() { () -> Void in 123 | guard let data = data, error == nil else { return } 124 | self.imageView.image = UIImage(data: data as Data) 125 | } 126 | } 127 | } 128 | 129 | } 130 | 131 | ``` 132 | 133 | ## 5. Info.plist 134 | 135 | 我们需要在info.plist文件中添加权限,这样的话app才能从play服务上获取URL和图片。 136 | 137 | ![minio_SWIFT6](https://github.com/minio/swift-photo-app/blob/master/docs/screenshots/infoplst1.01.png?raw=true) 138 | 139 | 以下是完整的info.plist文件。 140 | 141 | ```xml 142 | 143 | 144 | 145 | 146 | CFBundleDevelopmentRegion 147 | en 148 | CFBundleExecutable 149 | $(EXECUTABLE_NAME) 150 | CFBundleIdentifier 151 | $(PRODUCT_BUNDLE_IDENTIFIER) 152 | CFBundleInfoDictionaryVersion 153 | 6.0 154 | CFBundleName 155 | $(PRODUCT_NAME) 156 | CFBundlePackageType 157 | APPL 158 | CFBundleShortVersionString 159 | 1.0 160 | CFBundleSignature 161 | ???? 162 | CFBundleVersion 163 | 1 164 | LSRequiresIPhoneOS 165 | 166 | UILaunchStoryboardName 167 | LaunchScreen 168 | UIMainStoryboardFile 169 | Main 170 | UIRequiredDeviceCapabilities 171 | 172 | armv7 173 | 174 | UISupportedInterfaceOrientations 175 | 176 | UIInterfaceOrientationPortrait 177 | UIInterfaceOrientationLandscapeLeft 178 | UIInterfaceOrientationLandscapeRight 179 | 180 | 181 | NSAppTransportSecurity 182 | 183 | NSExceptionDomains 184 | 185 | play.minio.io 186 | 187 | NSIncludesSubdomains 188 | 189 | NSTemporaryExceptionAllowsInsecureHTTPLoads 190 | 191 | NSTemporaryExceptionMinimumTLSVersion 192 | 1.0 193 | NSTemporaryExceptionRequiresForwardSecrecy 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | ``` 202 | 203 | ## 7. 运行App 204 | 205 | * 启动iOS模拟器。 206 | * 点击play按钮deploy这个app到模拟器上并运行。 207 | * 点击`Load Random Image Button`随机加载一张图片。 208 | 209 | ## 8. 了解更多 210 | 211 | - [Photo API Service Example](https://docs.minio.io/docs/java-photo-api-service) 212 | - [Using `minio-java`client SDK with Minio Server](https://docs.minio.io/docs/java-client-quickstart-guide) 213 | - [Minio Java Client SDK API Reference](https://docs.minio.io/docs/java-client-api-reference) 214 | -------------------------------------------------------------------------------- /SwiftPhotoApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BBAFB88E1F16FD2C003B9BAC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBAFB88D1F16FD2C003B9BAC /* AppDelegate.swift */; }; 11 | BBAFB8901F16FD2C003B9BAC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBAFB88F1F16FD2C003B9BAC /* ViewController.swift */; }; 12 | BBAFB8931F16FD2C003B9BAC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BBAFB8911F16FD2C003B9BAC /* Main.storyboard */; }; 13 | BBAFB8951F16FD2C003B9BAC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BBAFB8941F16FD2C003B9BAC /* Assets.xcassets */; }; 14 | BBAFB8981F16FD2C003B9BAC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BBAFB8961F16FD2C003B9BAC /* LaunchScreen.storyboard */; }; 15 | BBAFB8A31F16FD2C003B9BAC /* SwiftPhAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBAFB8A21F16FD2C003B9BAC /* SwiftPhAppTests.swift */; }; 16 | BBAFB8AE1F16FD2C003B9BAC /* SwiftPhAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBAFB8AD1F16FD2C003B9BAC /* SwiftPhAppUITests.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | BBAFB89F1F16FD2C003B9BAC /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = BBAFB8821F16FD2C003B9BAC /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = BBAFB8891F16FD2C003B9BAC; 25 | remoteInfo = SwiftPhApp; 26 | }; 27 | BBAFB8AA1F16FD2C003B9BAC /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = BBAFB8821F16FD2C003B9BAC /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = BBAFB8891F16FD2C003B9BAC; 32 | remoteInfo = SwiftPhApp; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | BBAFB88A1F16FD2C003B9BAC /* SwiftPhApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftPhApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | BBAFB88D1F16FD2C003B9BAC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39 | BBAFB88F1F16FD2C003B9BAC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 40 | BBAFB8921F16FD2C003B9BAC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | BBAFB8941F16FD2C003B9BAC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 42 | BBAFB8971F16FD2C003B9BAC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 43 | BBAFB8991F16FD2C003B9BAC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | BBAFB89E1F16FD2C003B9BAC /* SwiftPhAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftPhAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | BBAFB8A21F16FD2C003B9BAC /* SwiftPhAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftPhAppTests.swift; sourceTree = ""; }; 46 | BBAFB8A41F16FD2C003B9BAC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | BBAFB8A91F16FD2C003B9BAC /* SwiftPhAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftPhAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | BBAFB8AD1F16FD2C003B9BAC /* SwiftPhAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftPhAppUITests.swift; sourceTree = ""; }; 49 | BBAFB8AF1F16FD2C003B9BAC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | BBAFB8871F16FD2C003B9BAC /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | BBAFB89B1F16FD2C003B9BAC /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | BBAFB8A61F16FD2C003B9BAC /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | BBAFB8811F16FD2C003B9BAC = { 78 | isa = PBXGroup; 79 | children = ( 80 | BBAFB88C1F16FD2C003B9BAC /* SwiftPhApp */, 81 | BBAFB8A11F16FD2C003B9BAC /* SwiftPhAppTests */, 82 | BBAFB8AC1F16FD2C003B9BAC /* SwiftPhAppUITests */, 83 | BBAFB88B1F16FD2C003B9BAC /* Products */, 84 | ); 85 | sourceTree = ""; 86 | }; 87 | BBAFB88B1F16FD2C003B9BAC /* Products */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | BBAFB88A1F16FD2C003B9BAC /* SwiftPhApp.app */, 91 | BBAFB89E1F16FD2C003B9BAC /* SwiftPhAppTests.xctest */, 92 | BBAFB8A91F16FD2C003B9BAC /* SwiftPhAppUITests.xctest */, 93 | ); 94 | name = Products; 95 | sourceTree = ""; 96 | }; 97 | BBAFB88C1F16FD2C003B9BAC /* SwiftPhApp */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | BBAFB88D1F16FD2C003B9BAC /* AppDelegate.swift */, 101 | BBAFB88F1F16FD2C003B9BAC /* ViewController.swift */, 102 | BBAFB8911F16FD2C003B9BAC /* Main.storyboard */, 103 | BBAFB8941F16FD2C003B9BAC /* Assets.xcassets */, 104 | BBAFB8961F16FD2C003B9BAC /* LaunchScreen.storyboard */, 105 | BBAFB8991F16FD2C003B9BAC /* Info.plist */, 106 | ); 107 | path = SwiftPhApp; 108 | sourceTree = ""; 109 | }; 110 | BBAFB8A11F16FD2C003B9BAC /* SwiftPhAppTests */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | BBAFB8A21F16FD2C003B9BAC /* SwiftPhAppTests.swift */, 114 | BBAFB8A41F16FD2C003B9BAC /* Info.plist */, 115 | ); 116 | path = SwiftPhAppTests; 117 | sourceTree = ""; 118 | }; 119 | BBAFB8AC1F16FD2C003B9BAC /* SwiftPhAppUITests */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | BBAFB8AD1F16FD2C003B9BAC /* SwiftPhAppUITests.swift */, 123 | BBAFB8AF1F16FD2C003B9BAC /* Info.plist */, 124 | ); 125 | path = SwiftPhAppUITests; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | BBAFB8891F16FD2C003B9BAC /* SwiftPhApp */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = BBAFB8B21F16FD2C003B9BAC /* Build configuration list for PBXNativeTarget "SwiftPhApp" */; 134 | buildPhases = ( 135 | BBAFB8861F16FD2C003B9BAC /* Sources */, 136 | BBAFB8871F16FD2C003B9BAC /* Frameworks */, 137 | BBAFB8881F16FD2C003B9BAC /* Resources */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = SwiftPhApp; 144 | productName = SwiftPhApp; 145 | productReference = BBAFB88A1F16FD2C003B9BAC /* SwiftPhApp.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | BBAFB89D1F16FD2C003B9BAC /* SwiftPhAppTests */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = BBAFB8B51F16FD2C003B9BAC /* Build configuration list for PBXNativeTarget "SwiftPhAppTests" */; 151 | buildPhases = ( 152 | BBAFB89A1F16FD2C003B9BAC /* Sources */, 153 | BBAFB89B1F16FD2C003B9BAC /* Frameworks */, 154 | BBAFB89C1F16FD2C003B9BAC /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | BBAFB8A01F16FD2C003B9BAC /* PBXTargetDependency */, 160 | ); 161 | name = SwiftPhAppTests; 162 | productName = SwiftPhAppTests; 163 | productReference = BBAFB89E1F16FD2C003B9BAC /* SwiftPhAppTests.xctest */; 164 | productType = "com.apple.product-type.bundle.unit-test"; 165 | }; 166 | BBAFB8A81F16FD2C003B9BAC /* SwiftPhAppUITests */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = BBAFB8B81F16FD2C003B9BAC /* Build configuration list for PBXNativeTarget "SwiftPhAppUITests" */; 169 | buildPhases = ( 170 | BBAFB8A51F16FD2C003B9BAC /* Sources */, 171 | BBAFB8A61F16FD2C003B9BAC /* Frameworks */, 172 | BBAFB8A71F16FD2C003B9BAC /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | BBAFB8AB1F16FD2C003B9BAC /* PBXTargetDependency */, 178 | ); 179 | name = SwiftPhAppUITests; 180 | productName = SwiftPhAppUITests; 181 | productReference = BBAFB8A91F16FD2C003B9BAC /* SwiftPhAppUITests.xctest */; 182 | productType = "com.apple.product-type.bundle.ui-testing"; 183 | }; 184 | /* End PBXNativeTarget section */ 185 | 186 | /* Begin PBXProject section */ 187 | BBAFB8821F16FD2C003B9BAC /* Project object */ = { 188 | isa = PBXProject; 189 | attributes = { 190 | LastSwiftUpdateCheck = 0830; 191 | LastUpgradeCheck = 0830; 192 | ORGANIZATIONNAME = Minio; 193 | TargetAttributes = { 194 | BBAFB8891F16FD2C003B9BAC = { 195 | CreatedOnToolsVersion = 8.3.3; 196 | ProvisioningStyle = Automatic; 197 | }; 198 | BBAFB89D1F16FD2C003B9BAC = { 199 | CreatedOnToolsVersion = 8.3.3; 200 | ProvisioningStyle = Automatic; 201 | TestTargetID = BBAFB8891F16FD2C003B9BAC; 202 | }; 203 | BBAFB8A81F16FD2C003B9BAC = { 204 | CreatedOnToolsVersion = 8.3.3; 205 | ProvisioningStyle = Automatic; 206 | TestTargetID = BBAFB8891F16FD2C003B9BAC; 207 | }; 208 | }; 209 | }; 210 | buildConfigurationList = BBAFB8851F16FD2C003B9BAC /* Build configuration list for PBXProject "SwiftPhApp" */; 211 | compatibilityVersion = "Xcode 3.2"; 212 | developmentRegion = English; 213 | hasScannedForEncodings = 0; 214 | knownRegions = ( 215 | en, 216 | Base, 217 | ); 218 | mainGroup = BBAFB8811F16FD2C003B9BAC; 219 | productRefGroup = BBAFB88B1F16FD2C003B9BAC /* Products */; 220 | projectDirPath = ""; 221 | projectRoot = ""; 222 | targets = ( 223 | BBAFB8891F16FD2C003B9BAC /* SwiftPhApp */, 224 | BBAFB89D1F16FD2C003B9BAC /* SwiftPhAppTests */, 225 | BBAFB8A81F16FD2C003B9BAC /* SwiftPhAppUITests */, 226 | ); 227 | }; 228 | /* End PBXProject section */ 229 | 230 | /* Begin PBXResourcesBuildPhase section */ 231 | BBAFB8881F16FD2C003B9BAC /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | BBAFB8981F16FD2C003B9BAC /* LaunchScreen.storyboard in Resources */, 236 | BBAFB8951F16FD2C003B9BAC /* Assets.xcassets in Resources */, 237 | BBAFB8931F16FD2C003B9BAC /* Main.storyboard in Resources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | BBAFB89C1F16FD2C003B9BAC /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | BBAFB8A71F16FD2C003B9BAC /* Resources */ = { 249 | isa = PBXResourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | /* End PBXResourcesBuildPhase section */ 256 | 257 | /* Begin PBXSourcesBuildPhase section */ 258 | BBAFB8861F16FD2C003B9BAC /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | BBAFB8901F16FD2C003B9BAC /* ViewController.swift in Sources */, 263 | BBAFB88E1F16FD2C003B9BAC /* AppDelegate.swift in Sources */, 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | BBAFB89A1F16FD2C003B9BAC /* Sources */ = { 268 | isa = PBXSourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | BBAFB8A31F16FD2C003B9BAC /* SwiftPhAppTests.swift in Sources */, 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | BBAFB8A51F16FD2C003B9BAC /* Sources */ = { 276 | isa = PBXSourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | BBAFB8AE1F16FD2C003B9BAC /* SwiftPhAppUITests.swift in Sources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXSourcesBuildPhase section */ 284 | 285 | /* Begin PBXTargetDependency section */ 286 | BBAFB8A01F16FD2C003B9BAC /* PBXTargetDependency */ = { 287 | isa = PBXTargetDependency; 288 | target = BBAFB8891F16FD2C003B9BAC /* SwiftPhApp */; 289 | targetProxy = BBAFB89F1F16FD2C003B9BAC /* PBXContainerItemProxy */; 290 | }; 291 | BBAFB8AB1F16FD2C003B9BAC /* PBXTargetDependency */ = { 292 | isa = PBXTargetDependency; 293 | target = BBAFB8891F16FD2C003B9BAC /* SwiftPhApp */; 294 | targetProxy = BBAFB8AA1F16FD2C003B9BAC /* PBXContainerItemProxy */; 295 | }; 296 | /* End PBXTargetDependency section */ 297 | 298 | /* Begin PBXVariantGroup section */ 299 | BBAFB8911F16FD2C003B9BAC /* Main.storyboard */ = { 300 | isa = PBXVariantGroup; 301 | children = ( 302 | BBAFB8921F16FD2C003B9BAC /* Base */, 303 | ); 304 | name = Main.storyboard; 305 | sourceTree = ""; 306 | }; 307 | BBAFB8961F16FD2C003B9BAC /* LaunchScreen.storyboard */ = { 308 | isa = PBXVariantGroup; 309 | children = ( 310 | BBAFB8971F16FD2C003B9BAC /* Base */, 311 | ); 312 | name = LaunchScreen.storyboard; 313 | sourceTree = ""; 314 | }; 315 | /* End PBXVariantGroup section */ 316 | 317 | /* Begin XCBuildConfiguration section */ 318 | BBAFB8B01F16FD2C003B9BAC /* Debug */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | ALWAYS_SEARCH_USER_PATHS = NO; 322 | CLANG_ANALYZER_NONNULL = YES; 323 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 325 | CLANG_CXX_LIBRARY = "libc++"; 326 | CLANG_ENABLE_MODULES = YES; 327 | CLANG_ENABLE_OBJC_ARC = YES; 328 | CLANG_WARN_BOOL_CONVERSION = YES; 329 | CLANG_WARN_CONSTANT_CONVERSION = YES; 330 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 331 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 332 | CLANG_WARN_EMPTY_BODY = YES; 333 | CLANG_WARN_ENUM_CONVERSION = YES; 334 | CLANG_WARN_INFINITE_RECURSION = YES; 335 | CLANG_WARN_INT_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 338 | CLANG_WARN_UNREACHABLE_CODE = YES; 339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 340 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 341 | COPY_PHASE_STRIP = NO; 342 | DEBUG_INFORMATION_FORMAT = dwarf; 343 | ENABLE_STRICT_OBJC_MSGSEND = YES; 344 | ENABLE_TESTABILITY = YES; 345 | GCC_C_LANGUAGE_STANDARD = gnu99; 346 | GCC_DYNAMIC_NO_PIC = NO; 347 | GCC_NO_COMMON_BLOCKS = YES; 348 | GCC_OPTIMIZATION_LEVEL = 0; 349 | GCC_PREPROCESSOR_DEFINITIONS = ( 350 | "DEBUG=1", 351 | "$(inherited)", 352 | ); 353 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 354 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 355 | GCC_WARN_UNDECLARED_SELECTOR = YES; 356 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 357 | GCC_WARN_UNUSED_FUNCTION = YES; 358 | GCC_WARN_UNUSED_VARIABLE = YES; 359 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 360 | MTL_ENABLE_DEBUG_INFO = YES; 361 | ONLY_ACTIVE_ARCH = YES; 362 | SDKROOT = iphoneos; 363 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 364 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 365 | }; 366 | name = Debug; 367 | }; 368 | BBAFB8B11F16FD2C003B9BAC /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ALWAYS_SEARCH_USER_PATHS = NO; 372 | CLANG_ANALYZER_NONNULL = YES; 373 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 374 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 375 | CLANG_CXX_LIBRARY = "libc++"; 376 | CLANG_ENABLE_MODULES = YES; 377 | CLANG_ENABLE_OBJC_ARC = YES; 378 | CLANG_WARN_BOOL_CONVERSION = YES; 379 | CLANG_WARN_CONSTANT_CONVERSION = YES; 380 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 381 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 382 | CLANG_WARN_EMPTY_BODY = YES; 383 | CLANG_WARN_ENUM_CONVERSION = YES; 384 | CLANG_WARN_INFINITE_RECURSION = YES; 385 | CLANG_WARN_INT_CONVERSION = YES; 386 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 387 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 388 | CLANG_WARN_UNREACHABLE_CODE = YES; 389 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 390 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 391 | COPY_PHASE_STRIP = NO; 392 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 393 | ENABLE_NS_ASSERTIONS = NO; 394 | ENABLE_STRICT_OBJC_MSGSEND = YES; 395 | GCC_C_LANGUAGE_STANDARD = gnu99; 396 | GCC_NO_COMMON_BLOCKS = YES; 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 404 | MTL_ENABLE_DEBUG_INFO = NO; 405 | SDKROOT = iphoneos; 406 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 407 | VALIDATE_PRODUCT = YES; 408 | }; 409 | name = Release; 410 | }; 411 | BBAFB8B31F16FD2C003B9BAC /* Debug */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 415 | INFOPLIST_FILE = SwiftPhApp/Info.plist; 416 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 417 | PRODUCT_BUNDLE_IDENTIFIER = com.example.minio.SwiftPhApp; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | SWIFT_VERSION = 3.0; 420 | }; 421 | name = Debug; 422 | }; 423 | BBAFB8B41F16FD2C003B9BAC /* Release */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 427 | INFOPLIST_FILE = SwiftPhApp/Info.plist; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 429 | PRODUCT_BUNDLE_IDENTIFIER = com.example.minio.SwiftPhApp; 430 | PRODUCT_NAME = "$(TARGET_NAME)"; 431 | SWIFT_VERSION = 3.0; 432 | }; 433 | name = Release; 434 | }; 435 | BBAFB8B61F16FD2C003B9BAC /* Debug */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 439 | BUNDLE_LOADER = "$(TEST_HOST)"; 440 | INFOPLIST_FILE = SwiftPhAppTests/Info.plist; 441 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 442 | PRODUCT_BUNDLE_IDENTIFIER = com.example.minio.SwiftPhAppTests; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SWIFT_VERSION = 3.0; 445 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftPhApp.app/SwiftPhApp"; 446 | }; 447 | name = Debug; 448 | }; 449 | BBAFB8B71F16FD2C003B9BAC /* Release */ = { 450 | isa = XCBuildConfiguration; 451 | buildSettings = { 452 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 453 | BUNDLE_LOADER = "$(TEST_HOST)"; 454 | INFOPLIST_FILE = SwiftPhAppTests/Info.plist; 455 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 456 | PRODUCT_BUNDLE_IDENTIFIER = com.example.minio.SwiftPhAppTests; 457 | PRODUCT_NAME = "$(TARGET_NAME)"; 458 | SWIFT_VERSION = 3.0; 459 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftPhApp.app/SwiftPhApp"; 460 | }; 461 | name = Release; 462 | }; 463 | BBAFB8B91F16FD2C003B9BAC /* Debug */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 467 | INFOPLIST_FILE = SwiftPhAppUITests/Info.plist; 468 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 469 | PRODUCT_BUNDLE_IDENTIFIER = com.example.minio.SwiftPhAppUITests; 470 | PRODUCT_NAME = "$(TARGET_NAME)"; 471 | SWIFT_VERSION = 3.0; 472 | TEST_TARGET_NAME = SwiftPhApp; 473 | }; 474 | name = Debug; 475 | }; 476 | BBAFB8BA1F16FD2C003B9BAC /* Release */ = { 477 | isa = XCBuildConfiguration; 478 | buildSettings = { 479 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 480 | INFOPLIST_FILE = SwiftPhAppUITests/Info.plist; 481 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 482 | PRODUCT_BUNDLE_IDENTIFIER = com.example.minio.SwiftPhAppUITests; 483 | PRODUCT_NAME = "$(TARGET_NAME)"; 484 | SWIFT_VERSION = 3.0; 485 | TEST_TARGET_NAME = SwiftPhApp; 486 | }; 487 | name = Release; 488 | }; 489 | /* End XCBuildConfiguration section */ 490 | 491 | /* Begin XCConfigurationList section */ 492 | BBAFB8851F16FD2C003B9BAC /* Build configuration list for PBXProject "SwiftPhApp" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | BBAFB8B01F16FD2C003B9BAC /* Debug */, 496 | BBAFB8B11F16FD2C003B9BAC /* Release */, 497 | ); 498 | defaultConfigurationIsVisible = 0; 499 | defaultConfigurationName = Release; 500 | }; 501 | BBAFB8B21F16FD2C003B9BAC /* Build configuration list for PBXNativeTarget "SwiftPhApp" */ = { 502 | isa = XCConfigurationList; 503 | buildConfigurations = ( 504 | BBAFB8B31F16FD2C003B9BAC /* Debug */, 505 | BBAFB8B41F16FD2C003B9BAC /* Release */, 506 | ); 507 | defaultConfigurationIsVisible = 0; 508 | }; 509 | BBAFB8B51F16FD2C003B9BAC /* Build configuration list for PBXNativeTarget "SwiftPhAppTests" */ = { 510 | isa = XCConfigurationList; 511 | buildConfigurations = ( 512 | BBAFB8B61F16FD2C003B9BAC /* Debug */, 513 | BBAFB8B71F16FD2C003B9BAC /* Release */, 514 | ); 515 | defaultConfigurationIsVisible = 0; 516 | }; 517 | BBAFB8B81F16FD2C003B9BAC /* Build configuration list for PBXNativeTarget "SwiftPhAppUITests" */ = { 518 | isa = XCConfigurationList; 519 | buildConfigurations = ( 520 | BBAFB8B91F16FD2C003B9BAC /* Debug */, 521 | BBAFB8BA1F16FD2C003B9BAC /* Release */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | }; 525 | /* End XCConfigurationList section */ 526 | }; 527 | rootObject = BBAFB8821F16FD2C003B9BAC /* Project object */; 528 | } 529 | -------------------------------------------------------------------------------- /SwiftPhotoApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftPhotoApp/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftPhotoApp, (C) 2017 Minio, Inc. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import UIKit 17 | 18 | @UIApplicationMain 19 | class AppDelegate: UIResponder, UIApplicationDelegate { 20 | 21 | var window: UIWindow? 22 | 23 | 24 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 25 | // Override point for customization after application launch. 26 | return true 27 | } 28 | 29 | func applicationWillResignActive(_ application: UIApplication) { 30 | // 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. 31 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 32 | } 33 | 34 | func applicationDidEnterBackground(_ application: UIApplication) { 35 | // 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. 36 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 37 | } 38 | 39 | func applicationWillEnterForeground(_ application: UIApplication) { 40 | // 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. 41 | } 42 | 43 | func applicationDidBecomeActive(_ application: UIApplication) { 44 | // 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. 45 | } 46 | 47 | func applicationWillTerminate(_ application: UIApplication) { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /SwiftPhotoApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /SwiftPhotoApp/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 | 31 | 32 | -------------------------------------------------------------------------------- /SwiftPhotoApp/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /SwiftPhotoApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | NSAppTransportSecurity 38 | 39 | NSExceptionDomains 40 | 41 | play.minio.io 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /SwiftPhotoApp/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftPhotoApp, (C) 2017 Minio, Inc. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | 17 | import UIKit 18 | 19 | class ViewController: UIViewController { 20 | 21 | @IBAction func refButton(sender: UIButton) { 22 | 23 | // Set up the URL Object. 24 | let url = URL(string: "http://play.minio.io:8080/PhotoAPIService-0.0.1-SNAPSHOT/minio/photoservice/list") 25 | 26 | // Task fetches the url contents asynchronously. 27 | let task = URLSession.shared.dataTask(with: url! as URL) {(data, response, error) in 28 | 29 | let httpResponse = response as! HTTPURLResponse 30 | let statusCode = httpResponse.statusCode 31 | 32 | // Process the response. 33 | if (statusCode == 200) { 34 | 35 | do{ 36 | // Get the json response. 37 | let json = try JSONSerialization.jsonObject(with: data!, options:.allowFragments) as! [String:AnyObject] 38 | 39 | // Extract the Album json into the albums array. 40 | if let albums = json["Album"] as? [[String: AnyObject]]{ 41 | 42 | // Pick a random index from the albums array. 43 | let randomIndex = Int(arc4random_uniform(UInt32(albums.count))) 44 | 45 | // Extract the url from the albums array using this random index we generated. 46 | let loadImageUrl:String = albums[randomIndex]["url"] as! String 47 | 48 | // Prepare the imageView. 49 | self.imageView.contentMode = .scaleAspectFit 50 | 51 | // Download and place the image in the image view with a helper function. 52 | if let checkedUrl = URL(string: loadImageUrl) { 53 | self.imageView.contentMode = .scaleAspectFit 54 | self.downloadImage(url: checkedUrl) 55 | } 56 | } 57 | } 58 | catch { 59 | print("Error with Json: \(error)") 60 | } 61 | } 62 | 63 | } 64 | 65 | task.resume() 66 | 67 | } 68 | 69 | @IBOutlet weak var imageView: UIImageView! 70 | override func viewDidLoad() { 71 | super.viewDidLoad() 72 | // Do any additional setup after loading the view, typically from a nib. 73 | } 74 | 75 | override func didReceiveMemoryWarning() { 76 | super.didReceiveMemoryWarning() 77 | // Dispose of any resources that can be recreated. 78 | } 79 | 80 | // Asynchronous helper function that fetches data from the PhotoAPIService. 81 | func getDataFromUrl(url:URL, completion: @escaping ((_ data: Data?, _ response: URLResponse?, _ error: Error? ) -> Void)) { 82 | URLSession.shared.dataTask(with: url as URL) { (data, response, error) in 83 | completion(data, response, error) 84 | }.resume() 85 | } 86 | 87 | // Helper function that download asynchronously an image from a given url. 88 | func downloadImage(url: URL){ 89 | getDataFromUrl(url: url) { (data, response, error) in 90 | DispatchQueue.main.async() { () -> Void in 91 | guard let data = data, error == nil else { return } 92 | self.imageView.image = UIImage(data: data as Data) 93 | } 94 | } 95 | } 96 | 97 | } 98 | 99 | -------------------------------------------------------------------------------- /SwiftPhotoAppTests/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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SwiftPhotoAppTests/SwiftPhAppTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftPhotoApp, (C) 2016 Minio, Inc. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | 17 | import XCTest 18 | @testable import SwiftPhApp 19 | 20 | class SwiftPhAppTests: XCTestCase { 21 | 22 | override func setUp() { 23 | super.setUp() 24 | // Put setup code here. This method is called before the invocation of each test method in the class. 25 | } 26 | 27 | override func tearDown() { 28 | // Put teardown code here. This method is called after the invocation of each test method in the class. 29 | super.tearDown() 30 | } 31 | 32 | func testExample() { 33 | // This is an example of a functional test case. 34 | // Use XCTAssert and related functions to verify your tests produce the correct results. 35 | } 36 | 37 | func testPerformanceExample() { 38 | // This is an example of a performance test case. 39 | self.measure { 40 | // Put the code you want to measure the time of here. 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /SwiftPhotoAppUITests/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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SwiftPhotoAppUITests/SwiftPhAppUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftPhotoApp, (C) 2016 Minio, Inc. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | import XCTest 17 | 18 | class SwiftPhAppUITests: XCTestCase { 19 | 20 | override func setUp() { 21 | super.setUp() 22 | 23 | // Put setup code here. This method is called before the invocation of each test method in the class. 24 | 25 | // In UI tests it is usually best to stop immediately when a failure occurs. 26 | continueAfterFailure = false 27 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 28 | XCUIApplication().launch() 29 | 30 | // 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. 31 | } 32 | 33 | override func tearDown() { 34 | // Put teardown code here. This method is called after the invocation of each test method in the class. 35 | super.tearDown() 36 | } 37 | 38 | func testExample() { 39 | // Use recording to get started writing UI tests. 40 | // Use XCTAssert and related functions to verify your tests produce the correct results. 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /docs/screenshots/infoplst1.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minio/swift-photo-app/e04de9d94e9d6c6b3c27ab3908e8f949cfb84272/docs/screenshots/infoplst1.01.png -------------------------------------------------------------------------------- /docs/screenshots/minio-SWIFT1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minio/swift-photo-app/e04de9d94e9d6c6b3c27ab3908e8f949cfb84272/docs/screenshots/minio-SWIFT1.jpg -------------------------------------------------------------------------------- /docs/screenshots/minio-SWIFT3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minio/swift-photo-app/e04de9d94e9d6c6b3c27ab3908e8f949cfb84272/docs/screenshots/minio-SWIFT3.jpg -------------------------------------------------------------------------------- /docs/screenshots/minio-SWIFT5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minio/swift-photo-app/e04de9d94e9d6c6b3c27ab3908e8f949cfb84272/docs/screenshots/minio-SWIFT5.jpg -------------------------------------------------------------------------------- /docs/screenshots/projectTemplate1.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minio/swift-photo-app/e04de9d94e9d6c6b3c27ab3908e8f949cfb84272/docs/screenshots/projectTemplate1.01.png -------------------------------------------------------------------------------- /docs/screenshots/storyBoard1.01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minio/swift-photo-app/e04de9d94e9d6c6b3c27ab3908e8f949cfb84272/docs/screenshots/storyBoard1.01.png --------------------------------------------------------------------------------