├── .gitignore ├── .swiftlint.yml ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE.txt ├── Podfile ├── Podfile.lock ├── README.md ├── art └── applicationScreencast.gif ├── iOSBasicTraining.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── iOSBasicTraining.xcscheme ├── iOSBasicTraining.xcworkspace └── contents.xcworkspacedata ├── iOSBasicTraining ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-40@2x.png │ │ ├── Icon-40@3x.png │ │ ├── Icon-60@2x.png │ │ └── Icon-60@3x.png │ ├── Contents.json │ ├── ic_avenger_badge.imageset │ │ ├── Contents.json │ │ └── ic_avengers.png │ └── ic_karumi_logo.imageset │ │ ├── 08_VERT + ALPHA.png │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── CaptureSuperHero.swift ├── CapturedSuperHeroesStorage.swift ├── Comic.swift ├── GetSuperHeroes.swift ├── Info.plist ├── MarvelSuperHeroesAPIClient.swift ├── Presenter.swift ├── SuperHero.swift ├── SuperHeroDetailPresenter.swift ├── SuperHeroDetailViewController.swift ├── SuperHeroTableViewCell.swift ├── SuperHeroesAPIClient.swift ├── SuperHeroesDetector.swift ├── SuperHeroesDetectorError.swift ├── SuperHeroesDetectorServiceLocator.swift ├── SuperHeroesDetectorViewController.swift ├── SuperHeroesPresenter.swift ├── SuperHeroesRepository.swift ├── SuperHeroesViewController.swift ├── UIColor.swift └── UIView.swift └── iOSBasicTrainingTests ├── Info.plist ├── MockSuperHeroesAPIClient.swift ├── SuperHero.swift ├── SuperHeroTests.swift ├── SuperHeroesBuilder.swift ├── SuperHeroesDetectorTests.swift └── iOSBasicTrainingTests-Bridging-Header.h /.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 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 35 | # 36 | Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: # rule identifiers to exclude from running 2 | - force_cast 3 | - line_length 4 | - function_parameter_count 5 | - function_body_length 6 | 7 | excluded: # paths to ignore during linting. overridden by `included`. 8 | - Carthage 9 | - Pods 10 | 11 | variable_name: 12 | min_length: 13 | warning: 1 14 | 15 | trailing_whitespace: error 16 | control_statement: error 17 | colon: error 18 | opening_brace: error 19 | return_arrow_whitespace: error 20 | trailing_semicolon: error 21 | statement_position: error 22 | legacy_constructor: error 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode7.3 3 | cache: cocoapods 4 | 5 | before_install: 6 | - brew update 7 | - brew install swiftlint 8 | - gem install cocoapods 9 | - pod repo update --silent 10 | - gem install xcpretty 11 | 12 | script: 13 | - swiftlint 14 | - set -o pipefail && xcodebuild -workspace iOSBasicTraining.xcworkspace -scheme 'iOSBasicTraining' -destination 'platform=iOS Simulator,name=iPhone 6s Plus' build test CODE_SIGN_IDENTITY=- | xcpretty -c 15 | 16 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | :+1::tada: First off, thanks for taking the time to contribute! :tada::+1: 5 | 6 | If you would like to contribute code to this repository you can do so through GitHub by 7 | forking the repository and sending a pull request or opening an issue. 8 | 9 | When submitting code, please make every effort to follow existing conventions 10 | and style in order to keep the code as readable as possible. Please also make 11 | sure your code compiles, passes the tests and the checkstyle configured for this repository. 12 | 13 | 14 | Some tips that will help you to contribute to this repository: 15 | 16 | * Write clean code and test it. 17 | * Follow the repository code style. 18 | * Write good commit messages. 19 | * Do not send pull requests without checking if the project build is OK in Travis-CI. 20 | * Review if your changes affects the repository documentation and update it. 21 | * Describe the PR content and don't hesitate to add comments to explain us why you've added or changed something. 22 | 23 | Code of conduct 24 | --------------- 25 | 26 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 27 | 28 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. 29 | 30 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 31 | 32 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 33 | 34 | This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. 35 | 36 | Instances of abusive, harassing, or otherwise unacceptable behavior can be reported by emailing hello@karumi.com. 37 | 38 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org/version/1/3/0/), version 1.3.0, available at [http://contributor-covenant.org/version/1/3/0/](http://contributor-covenant.org/version/1/3/0/). -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 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 | 203 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | target 'iOSBasicTraining' do 2 | use_frameworks! 3 | 4 | pod 'Result' 5 | pod 'SDWebImage' 6 | pod 'Toast' 7 | pod 'MarvelAPIClient', :git => 'https://github.com/Karumi/MarvelAPIClient.git' 8 | 9 | target 'iOSBasicTrainingTests' do 10 | inherit! :search_paths 11 | 12 | pod 'Nimble' 13 | 14 | end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BothamNetworking (1.1.0): 3 | - Result 4 | - SwiftyJSON 5 | - CryptoSwift (0.5.1) 6 | - MarvelAPIClient (0.0.1): 7 | - BothamNetworking 8 | - CryptoSwift 9 | - SwiftyJSON 10 | - Nimble (4.1.0) 11 | - Result (2.1.1) 12 | - SDWebImage (3.8.1): 13 | - SDWebImage/Core (= 3.8.1) 14 | - SDWebImage/Core (3.8.1) 15 | - SwiftyJSON (2.3.2) 16 | - Toast (3.0) 17 | 18 | DEPENDENCIES: 19 | - MarvelAPIClient (from `https://github.com/Karumi/MarvelAPIClient.git`) 20 | - Nimble 21 | - Result 22 | - SDWebImage 23 | - Toast 24 | 25 | EXTERNAL SOURCES: 26 | MarvelAPIClient: 27 | :git: https://github.com/Karumi/MarvelAPIClient.git 28 | 29 | CHECKOUT OPTIONS: 30 | MarvelAPIClient: 31 | :commit: b33c46b9e16756baa50661bc3e90847b73d04027 32 | :git: https://github.com/Karumi/MarvelAPIClient.git 33 | 34 | SPEC CHECKSUMS: 35 | BothamNetworking: 3396c9b18938ddaa47c44a8c3abf47db1fc7e42e 36 | CryptoSwift: df42dda18baf6c76347a94e227dbcc0a341304bd 37 | MarvelAPIClient: 95c5af8072347c2c68d93c11037ceb35ea6c4868 38 | Nimble: 97a0a4cae5124c117115634b2d055d8c97d0af19 39 | Result: 822c879f145943320cc80a9a8372378e3d699fe4 40 | SDWebImage: 35f9627a3e44b4f292a8a8ce6a531fa488239b91 41 | SwiftyJSON: 04ccea08915aa0109039157c7974cf0298da292a 42 | Toast: 32c59229abfcf41850162b83bb9259dc84372473 43 | 44 | PODFILE CHECKSUM: 7d8ec386771b7971e784061152ddf80fe32bdf53 45 | 46 | COCOAPODS: 1.0.1 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![karumilogo] iOS Basic Training 2 | [![Build Status](https://travis-ci.org/Karumi/iOSBasicTraining.svg?branch=master)](https://travis-ci.org/Karumi/iOSBasicTraining) 3 | 4 | Code associated to the first level of the Karumi iOS Training. 5 | 6 | ##Earth 11 Avengers Detector 7 | 8 | In Earth 11 the world of super heroes has completely changed. Super heroes are super villans and viceversa. In this earth the Avengers team is now an evil coporation and is not composed by the usual super heroes. The new members of this organization are unknown. 9 | 10 | After collaborating with [The Flash from Earth 1][flash] Central City Police Departament has noticed that the new Avengers Team members are the one containing the number four in the super hero id. **Your mission, if you decide to accept it, is to develop an iOS application to show a list of super heroes obtained from a remote API showing the Avengers badge if the super hero is part of the Earth 11 evil Avengers Team.** 11 | 12 | As super heroes are now super villans the Cental City Police Departament also requested us a feature to be able to mark a super hero as captured in the detailed screen. Once the super hero has been captured the system will not show information related to the super hero anymore. 13 | 14 | ##Application mockups 15 | 16 | ![ApplicationScreencast][applicationScreencast] 17 | 18 | ##Tasks 19 | 20 | 21 | * **Task 1:** 22 | 23 | * Create an empty iOS project from XCode. 24 | * Configure [CocoaPods][cocoapods]. 25 | * Implement part of the domain model abstracting the data source. 26 | * Write the unit tests needed to cover this functionality. You can use [Nimble][nimble] to implement your matchers. 27 | * **Bonus:** 28 | * Configure Travis-CI as a continous integration system. 29 | * Configure Swiftlint as checkstyle tool. 30 | * Change application logo. 31 | * Change the splash screen xib to use the app logo. 32 | 33 | * **Task 2:** 34 | 35 | * Implement the Super Hero Detail UIViewController using the XCode interface builder and show some mocked data there. 36 | * Add a button to the first view controller to connect this view controller with the detail view controller and implement this navigation. 37 | * **Bonus:** 38 | * Read the [KIF Framework][kif] documentation and sample project. 39 | * Using the iOS simulator review the accessibility labels configured. 40 | 41 | * **Task 3:** 42 | 43 | * Implement the Super Heroes UIViewController using a table view. 44 | * Show some mocked data in the already implemented Super Heroes screen. 45 | * Connect the super heroes screen with the system you wrote during the task 1. 46 | * The tests needed to cover this new funtionality will be covered during another [exercise][kataSuperHeroes]. 47 | * **Bonus:** 48 | * Replace your UITableView widget with a UICollectionView. 49 | * Change the Super Heroes screen to show 3 columns if the device is an iPad and 1 column by default. 50 | * Write some UI Tests using the UI Test recorder. 51 | 52 | * **Task 4:** 53 | 54 | * Refactor the already implemented view controllers to use [Model View Presenter][mvp] to develop the application presentation layer. 55 | * Create all the use cases needed to connect your presentation layer with the already implemented domain. 56 | * Create a repository to hide the usage of the SuperHeroesAPIClient as data source and be able to add more data sources in the future if needed. 57 | * Bonus: 58 | * Review other UI patterns like [Model View ViewModel][mvvm] and reimplement the presentation layer. 59 | 60 | * **Task 5:** 61 | 62 | * Connect your already implemented domain with the remote API using an already implemented [Marvel API Client][marvelApiClient] following the repository pattern. 63 | * The tests needed to cover this new funtionality will be covered during aother [exercise][kataTodoAPIClient]. 64 | * **Bonus:** 65 | * Using Alamofire implement your own Marvel API Client and replace the old one with this one. 66 | * Write some integration tests using HTTP stubbing with [Nocilla][nocilla] 67 | * Add persistence to the application. 68 | * Replace the usage of completion handlers with promisses or observables. 69 | 70 | * **Extra tasks:** 71 | 72 | * Change your [Model View Presenter][mvp] implementation to use [Botham UI][bothamUI] 73 | * Add a pull to refresh mechanism. 74 | * Add an infinite load mechanism and implement pagination. 75 | * Improve the UX related to the capture a super hero process avoiding the blink effect when a super hero is captured. How can you do this? 76 | 77 | License 78 | ------- 79 | 80 | Copyright 2016 Karumi 81 | 82 | Licensed under the Apache License, Version 2.0 (the "License"); 83 | you may not use this file except in compliance with the License. 84 | You may obtain a copy of the License at 85 | 86 | http://www.apache.org/licenses/LICENSE-2.0 87 | 88 | Unless required by applicable law or agreed to in writing, software 89 | distributed under the License is distributed on an "AS IS" BASIS, 90 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 91 | See the License for the specific language governing permissions and 92 | limitations under the License. 93 | 94 | [karumilogo]: https://cloud.githubusercontent.com/assets/858090/11626547/e5a1dc66-9ce3-11e5-908d-537e07e82090.png 95 | 96 | 97 | [karumilogo]: https://cloud.githubusercontent.com/assets/858090/11626547/e5a1dc66-9ce3-11e5-908d-537e07e82090.png 98 | [applicationScreencast]: ./art/applicationScreencast.gif 99 | [cocoapods]: https://guides.cocoapods.org/using/getting-started.html 100 | [kif]: https://github.com/kif-framework/KIF 101 | [nimble]: https://github.com/Quick/Nimble 102 | [mvp]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter 103 | [marvelApiClient]: https://github.com/Karumi/MarvelApiClient 104 | [mvvm]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel 105 | [flash]: https://en.wikipedia.org/wiki/Flash_(comics) 106 | [kataSuperHeroes]: https://github.com/Karumi/KataSuperHeroesIOS/ 107 | [nocilla]: https://github.com/luisobo/Nocilla 108 | [kataTodoAPIClient]: https://github.com/Karumi/KataTODOApiClientIOS 109 | [bothamUI]: https://github.com/Karumi/BothamUI/ 110 | -------------------------------------------------------------------------------- /art/applicationScreencast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Karumi/iOSBasicTraining/d56b99b8589999f8f5137eb66c53f05ec3d115f6/art/applicationScreencast.gif -------------------------------------------------------------------------------- /iOSBasicTraining.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B01599EEDAA398935B7A381 /* Pods_iOSBasicTrainingTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 717EB6991E4CF84FA04D8E00 /* Pods_iOSBasicTrainingTests.framework */; }; 11 | 646C25C373F5DC9F927CF5D1 /* Pods_iOSBasicTraining.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2A05B32F43B02AFE749853A /* Pods_iOSBasicTraining.framework */; }; 12 | EB4737501D1FEFFD0055956A /* CaptureSuperHero.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB47374F1D1FEFFD0055956A /* CaptureSuperHero.swift */; }; 13 | EB4737521D1FF0080055956A /* GetSuperHeroes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB4737511D1FF0080055956A /* GetSuperHeroes.swift */; }; 14 | EB4737551D1FF1D10055956A /* SuperHeroesRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB4737541D1FF1D10055956A /* SuperHeroesRepository.swift */; }; 15 | EB7945801D1D4FDE00115EC8 /* SuperHeroDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB79457F1D1D4FDE00115EC8 /* SuperHeroDetailViewController.swift */; }; 16 | EB7945831D1D51D600115EC8 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7945821D1D51D600115EC8 /* UIView.swift */; }; 17 | EB7945851D1D744400115EC8 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7945841D1D744400115EC8 /* UIColor.swift */; }; 18 | EB7945881D1D753700115EC8 /* SuperHeroTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7945871D1D753700115EC8 /* SuperHeroTableViewCell.swift */; }; 19 | EB79458E1D1D85BD00115EC8 /* Presenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB79458D1D1D85BD00115EC8 /* Presenter.swift */; }; 20 | EB7945901D1D862E00115EC8 /* SuperHeroesPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB79458F1D1D862E00115EC8 /* SuperHeroesPresenter.swift */; }; 21 | EB7945921D1D863500115EC8 /* SuperHeroDetailPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7945911D1D863500115EC8 /* SuperHeroDetailPresenter.swift */; }; 22 | EB7945941D1D882400115EC8 /* SuperHeroesDetectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7945931D1D882400115EC8 /* SuperHeroesDetectorViewController.swift */; }; 23 | EB7945961D1D891500115EC8 /* SuperHeroesDetectorServiceLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7945951D1D891500115EC8 /* SuperHeroesDetectorServiceLocator.swift */; }; 24 | EB7945981D1D90CB00115EC8 /* MarvelSuperHeroesAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7945971D1D90CB00115EC8 /* MarvelSuperHeroesAPIClient.swift */; }; 25 | EBA82A331D1D1F4E0089DF88 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A321D1D1F4E0089DF88 /* AppDelegate.swift */; }; 26 | EBA82A351D1D1F4E0089DF88 /* SuperHeroesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A341D1D1F4E0089DF88 /* SuperHeroesViewController.swift */; }; 27 | EBA82A381D1D1F4E0089DF88 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EBA82A361D1D1F4E0089DF88 /* Main.storyboard */; }; 28 | EBA82A3A1D1D1F4E0089DF88 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EBA82A391D1D1F4E0089DF88 /* Assets.xcassets */; }; 29 | EBA82A3D1D1D1F4E0089DF88 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EBA82A3B1D1D1F4E0089DF88 /* LaunchScreen.storyboard */; }; 30 | EBA82A571D1D26180089DF88 /* SuperHero.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A561D1D26180089DF88 /* SuperHero.swift */; }; 31 | EBA82A591D1D26920089DF88 /* Comic.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A581D1D26920089DF88 /* Comic.swift */; }; 32 | EBA82A5C1D1D26DB0089DF88 /* SuperHeroTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A5B1D1D26DB0089DF88 /* SuperHeroTests.swift */; }; 33 | EBA82A601D1D27E90089DF88 /* SuperHeroesBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A5F1D1D27E90089DF88 /* SuperHeroesBuilder.swift */; }; 34 | EBA82A621D1D3AD10089DF88 /* SuperHeroesDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A611D1D3AD10089DF88 /* SuperHeroesDetector.swift */; }; 35 | EBA82A651D1D3AF30089DF88 /* SuperHeroesAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A641D1D3AF30089DF88 /* SuperHeroesAPIClient.swift */; }; 36 | EBA82A681D1D3B670089DF88 /* CapturedSuperHeroesStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A671D1D3B670089DF88 /* CapturedSuperHeroesStorage.swift */; }; 37 | EBA82A6A1D1D3FE10089DF88 /* SuperHeroesDetectorError.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A691D1D3FE10089DF88 /* SuperHeroesDetectorError.swift */; }; 38 | EBA82A6C1D1D422A0089DF88 /* SuperHeroesDetectorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A6B1D1D422A0089DF88 /* SuperHeroesDetectorTests.swift */; }; 39 | EBA82A6F1D1D42DB0089DF88 /* MockSuperHeroesAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A6E1D1D42DB0089DF88 /* MockSuperHeroesAPIClient.swift */; }; 40 | EBA82A721D1D44790089DF88 /* SuperHero.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA82A711D1D44790089DF88 /* SuperHero.swift */; }; 41 | /* End PBXBuildFile section */ 42 | 43 | /* Begin PBXContainerItemProxy section */ 44 | EBA82A441D1D1F4E0089DF88 /* PBXContainerItemProxy */ = { 45 | isa = PBXContainerItemProxy; 46 | containerPortal = EBA82A271D1D1F4E0089DF88 /* Project object */; 47 | proxyType = 1; 48 | remoteGlobalIDString = EBA82A2E1D1D1F4E0089DF88; 49 | remoteInfo = iOSBasicTraining; 50 | }; 51 | /* End PBXContainerItemProxy section */ 52 | 53 | /* Begin PBXFileReference section */ 54 | 38CDB279D2411D6931C099DA /* Pods-iOSBasicTrainingTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOSBasicTrainingTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-iOSBasicTrainingTests/Pods-iOSBasicTrainingTests.release.xcconfig"; sourceTree = ""; }; 55 | 5BD0C264AFC720381E4CCD11 /* Pods-iOSBasicTraining.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOSBasicTraining.debug.xcconfig"; path = "Pods/Target Support Files/Pods-iOSBasicTraining/Pods-iOSBasicTraining.debug.xcconfig"; sourceTree = ""; }; 56 | 6A04285918E4D5E401E2076E /* Pods-iOSBasicTrainingTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOSBasicTrainingTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-iOSBasicTrainingTests/Pods-iOSBasicTrainingTests.debug.xcconfig"; sourceTree = ""; }; 57 | 717EB6991E4CF84FA04D8E00 /* Pods_iOSBasicTrainingTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iOSBasicTrainingTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | A23F24A9F3E00ED5C6923BAF /* Pods-iOSBasicTraining.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOSBasicTraining.release.xcconfig"; path = "Pods/Target Support Files/Pods-iOSBasicTraining/Pods-iOSBasicTraining.release.xcconfig"; sourceTree = ""; }; 59 | D2A05B32F43B02AFE749853A /* Pods_iOSBasicTraining.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iOSBasicTraining.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | EB47374F1D1FEFFD0055956A /* CaptureSuperHero.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureSuperHero.swift; sourceTree = ""; }; 61 | EB4737511D1FF0080055956A /* GetSuperHeroes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GetSuperHeroes.swift; sourceTree = ""; }; 62 | EB4737541D1FF1D10055956A /* SuperHeroesRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesRepository.swift; sourceTree = ""; }; 63 | EB79457F1D1D4FDE00115EC8 /* SuperHeroDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroDetailViewController.swift; sourceTree = ""; }; 64 | EB7945821D1D51D600115EC8 /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = ""; }; 65 | EB7945841D1D744400115EC8 /* UIColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = ""; }; 66 | EB7945871D1D753700115EC8 /* SuperHeroTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroTableViewCell.swift; sourceTree = ""; }; 67 | EB79458D1D1D85BD00115EC8 /* Presenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Presenter.swift; sourceTree = ""; }; 68 | EB79458F1D1D862E00115EC8 /* SuperHeroesPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesPresenter.swift; sourceTree = ""; }; 69 | EB7945911D1D863500115EC8 /* SuperHeroDetailPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroDetailPresenter.swift; sourceTree = ""; }; 70 | EB7945931D1D882400115EC8 /* SuperHeroesDetectorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesDetectorViewController.swift; sourceTree = ""; }; 71 | EB7945951D1D891500115EC8 /* SuperHeroesDetectorServiceLocator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesDetectorServiceLocator.swift; sourceTree = ""; }; 72 | EB7945971D1D90CB00115EC8 /* MarvelSuperHeroesAPIClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarvelSuperHeroesAPIClient.swift; sourceTree = ""; }; 73 | EBA82A2F1D1D1F4E0089DF88 /* iOSBasicTraining.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSBasicTraining.app; sourceTree = BUILT_PRODUCTS_DIR; }; 74 | EBA82A321D1D1F4E0089DF88 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 75 | EBA82A341D1D1F4E0089DF88 /* SuperHeroesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuperHeroesViewController.swift; sourceTree = ""; }; 76 | EBA82A371D1D1F4E0089DF88 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 77 | EBA82A391D1D1F4E0089DF88 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 78 | EBA82A3C1D1D1F4E0089DF88 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 79 | EBA82A3E1D1D1F4E0089DF88 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 80 | EBA82A431D1D1F4E0089DF88 /* iOSBasicTrainingTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSBasicTrainingTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 81 | EBA82A491D1D1F4E0089DF88 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 82 | EBA82A561D1D26180089DF88 /* SuperHero.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHero.swift; sourceTree = ""; }; 83 | EBA82A581D1D26920089DF88 /* Comic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Comic.swift; sourceTree = ""; }; 84 | EBA82A5A1D1D26DB0089DF88 /* iOSBasicTrainingTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iOSBasicTrainingTests-Bridging-Header.h"; sourceTree = ""; }; 85 | EBA82A5B1D1D26DB0089DF88 /* SuperHeroTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroTests.swift; sourceTree = ""; }; 86 | EBA82A5F1D1D27E90089DF88 /* SuperHeroesBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesBuilder.swift; sourceTree = ""; }; 87 | EBA82A611D1D3AD10089DF88 /* SuperHeroesDetector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesDetector.swift; sourceTree = ""; }; 88 | EBA82A641D1D3AF30089DF88 /* SuperHeroesAPIClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesAPIClient.swift; sourceTree = ""; }; 89 | EBA82A671D1D3B670089DF88 /* CapturedSuperHeroesStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapturedSuperHeroesStorage.swift; sourceTree = ""; }; 90 | EBA82A691D1D3FE10089DF88 /* SuperHeroesDetectorError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesDetectorError.swift; sourceTree = ""; }; 91 | EBA82A6B1D1D422A0089DF88 /* SuperHeroesDetectorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHeroesDetectorTests.swift; sourceTree = ""; }; 92 | EBA82A6E1D1D42DB0089DF88 /* MockSuperHeroesAPIClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockSuperHeroesAPIClient.swift; sourceTree = ""; }; 93 | EBA82A711D1D44790089DF88 /* SuperHero.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperHero.swift; sourceTree = ""; }; 94 | /* End PBXFileReference section */ 95 | 96 | /* Begin PBXFrameworksBuildPhase section */ 97 | EBA82A2C1D1D1F4E0089DF88 /* Frameworks */ = { 98 | isa = PBXFrameworksBuildPhase; 99 | buildActionMask = 2147483647; 100 | files = ( 101 | 646C25C373F5DC9F927CF5D1 /* Pods_iOSBasicTraining.framework in Frameworks */, 102 | ); 103 | runOnlyForDeploymentPostprocessing = 0; 104 | }; 105 | EBA82A401D1D1F4E0089DF88 /* Frameworks */ = { 106 | isa = PBXFrameworksBuildPhase; 107 | buildActionMask = 2147483647; 108 | files = ( 109 | 4B01599EEDAA398935B7A381 /* Pods_iOSBasicTrainingTests.framework in Frameworks */, 110 | ); 111 | runOnlyForDeploymentPostprocessing = 0; 112 | }; 113 | /* End PBXFrameworksBuildPhase section */ 114 | 115 | /* Begin PBXGroup section */ 116 | 1444FB9780EB0E8EE935A1EA /* Frameworks */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | D2A05B32F43B02AFE749853A /* Pods_iOSBasicTraining.framework */, 120 | 717EB6991E4CF84FA04D8E00 /* Pods_iOSBasicTrainingTests.framework */, 121 | ); 122 | name = Frameworks; 123 | sourceTree = ""; 124 | }; 125 | 8FDF82A03E65C74CB335D930 /* Pods */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 5BD0C264AFC720381E4CCD11 /* Pods-iOSBasicTraining.debug.xcconfig */, 129 | A23F24A9F3E00ED5C6923BAF /* Pods-iOSBasicTraining.release.xcconfig */, 130 | 6A04285918E4D5E401E2076E /* Pods-iOSBasicTrainingTests.debug.xcconfig */, 131 | 38CDB279D2411D6931C099DA /* Pods-iOSBasicTrainingTests.release.xcconfig */, 132 | ); 133 | name = Pods; 134 | sourceTree = ""; 135 | }; 136 | EB4737531D1FF0A20055956A /* Use Cases */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | EB47374F1D1FEFFD0055956A /* CaptureSuperHero.swift */, 140 | EB4737511D1FF0080055956A /* GetSuperHeroes.swift */, 141 | ); 142 | name = "Use Cases"; 143 | sourceTree = ""; 144 | }; 145 | EB79457D1D1D4FCD00115EC8 /* UI */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | EB79458B1D1D851A00115EC8 /* Presenter */, 149 | EB79457E1D1D4FD400115EC8 /* View */, 150 | ); 151 | name = UI; 152 | sourceTree = ""; 153 | }; 154 | EB79457E1D1D4FD400115EC8 /* View */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | EB7945861D1D752E00115EC8 /* Cells */, 158 | EBA82A341D1D1F4E0089DF88 /* SuperHeroesViewController.swift */, 159 | EB79457F1D1D4FDE00115EC8 /* SuperHeroDetailViewController.swift */, 160 | EBA82A361D1D1F4E0089DF88 /* Main.storyboard */, 161 | ); 162 | name = View; 163 | sourceTree = ""; 164 | }; 165 | EB7945811D1D51AD00115EC8 /* Extensions */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | EB7945821D1D51D600115EC8 /* UIView.swift */, 169 | EB7945841D1D744400115EC8 /* UIColor.swift */, 170 | ); 171 | name = Extensions; 172 | sourceTree = ""; 173 | }; 174 | EB7945861D1D752E00115EC8 /* Cells */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | EB7945871D1D753700115EC8 /* SuperHeroTableViewCell.swift */, 178 | ); 179 | name = Cells; 180 | sourceTree = ""; 181 | }; 182 | EB79458B1D1D851A00115EC8 /* Presenter */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | EB79458F1D1D862E00115EC8 /* SuperHeroesPresenter.swift */, 186 | EB7945911D1D863500115EC8 /* SuperHeroDetailPresenter.swift */, 187 | ); 188 | name = Presenter; 189 | sourceTree = ""; 190 | }; 191 | EB79458C1D1D859100115EC8 /* MVP */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | EB79458D1D1D85BD00115EC8 /* Presenter.swift */, 195 | EB7945931D1D882400115EC8 /* SuperHeroesDetectorViewController.swift */, 196 | ); 197 | name = MVP; 198 | sourceTree = ""; 199 | }; 200 | EBA82A261D1D1F4E0089DF88 = { 201 | isa = PBXGroup; 202 | children = ( 203 | EBA82A311D1D1F4E0089DF88 /* iOSBasicTraining */, 204 | EBA82A461D1D1F4E0089DF88 /* iOSBasicTrainingTests */, 205 | EBA82A301D1D1F4E0089DF88 /* Products */, 206 | 8FDF82A03E65C74CB335D930 /* Pods */, 207 | 1444FB9780EB0E8EE935A1EA /* Frameworks */, 208 | ); 209 | sourceTree = ""; 210 | }; 211 | EBA82A301D1D1F4E0089DF88 /* Products */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | EBA82A2F1D1D1F4E0089DF88 /* iOSBasicTraining.app */, 215 | EBA82A431D1D1F4E0089DF88 /* iOSBasicTrainingTests.xctest */, 216 | ); 217 | name = Products; 218 | sourceTree = ""; 219 | }; 220 | EBA82A311D1D1F4E0089DF88 /* iOSBasicTraining */ = { 221 | isa = PBXGroup; 222 | children = ( 223 | EBA82A541D1D25FA0089DF88 /* Domain */, 224 | EB79457D1D1D4FCD00115EC8 /* UI */, 225 | EB79458C1D1D859100115EC8 /* MVP */, 226 | EB7945811D1D51AD00115EC8 /* Extensions */, 227 | EB7945951D1D891500115EC8 /* SuperHeroesDetectorServiceLocator.swift */, 228 | EBA82A321D1D1F4E0089DF88 /* AppDelegate.swift */, 229 | EBA82A3B1D1D1F4E0089DF88 /* LaunchScreen.storyboard */, 230 | EBA82A391D1D1F4E0089DF88 /* Assets.xcassets */, 231 | EBA82A3E1D1D1F4E0089DF88 /* Info.plist */, 232 | ); 233 | path = iOSBasicTraining; 234 | sourceTree = ""; 235 | }; 236 | EBA82A461D1D1F4E0089DF88 /* iOSBasicTrainingTests */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | EBA82A5D1D1D26E50089DF88 /* Domain */, 240 | EBA82A701D1D446F0089DF88 /* Extensions */, 241 | EBA82A6D1D1D42D00089DF88 /* Test Doubles */, 242 | EBA82A5E1D1D27DC0089DF88 /* Builders */, 243 | EBA82A491D1D1F4E0089DF88 /* Info.plist */, 244 | EBA82A5A1D1D26DB0089DF88 /* iOSBasicTrainingTests-Bridging-Header.h */, 245 | ); 246 | path = iOSBasicTrainingTests; 247 | sourceTree = ""; 248 | }; 249 | EBA82A541D1D25FA0089DF88 /* Domain */ = { 250 | isa = PBXGroup; 251 | children = ( 252 | EB4737531D1FF0A20055956A /* Use Cases */, 253 | EBA82A661D1D3B5B0089DF88 /* Storage */, 254 | EBA82A631D1D3ADD0089DF88 /* API Client */, 255 | EBA82A561D1D26180089DF88 /* SuperHero.swift */, 256 | EBA82A581D1D26920089DF88 /* Comic.swift */, 257 | EBA82A611D1D3AD10089DF88 /* SuperHeroesDetector.swift */, 258 | EB4737541D1FF1D10055956A /* SuperHeroesRepository.swift */, 259 | EBA82A691D1D3FE10089DF88 /* SuperHeroesDetectorError.swift */, 260 | ); 261 | name = Domain; 262 | sourceTree = ""; 263 | }; 264 | EBA82A5D1D1D26E50089DF88 /* Domain */ = { 265 | isa = PBXGroup; 266 | children = ( 267 | EBA82A5B1D1D26DB0089DF88 /* SuperHeroTests.swift */, 268 | EBA82A6B1D1D422A0089DF88 /* SuperHeroesDetectorTests.swift */, 269 | ); 270 | name = Domain; 271 | sourceTree = ""; 272 | }; 273 | EBA82A5E1D1D27DC0089DF88 /* Builders */ = { 274 | isa = PBXGroup; 275 | children = ( 276 | EBA82A5F1D1D27E90089DF88 /* SuperHeroesBuilder.swift */, 277 | ); 278 | name = Builders; 279 | sourceTree = ""; 280 | }; 281 | EBA82A631D1D3ADD0089DF88 /* API Client */ = { 282 | isa = PBXGroup; 283 | children = ( 284 | EBA82A641D1D3AF30089DF88 /* SuperHeroesAPIClient.swift */, 285 | EB7945971D1D90CB00115EC8 /* MarvelSuperHeroesAPIClient.swift */, 286 | ); 287 | name = "API Client"; 288 | sourceTree = ""; 289 | }; 290 | EBA82A661D1D3B5B0089DF88 /* Storage */ = { 291 | isa = PBXGroup; 292 | children = ( 293 | EBA82A671D1D3B670089DF88 /* CapturedSuperHeroesStorage.swift */, 294 | ); 295 | name = Storage; 296 | sourceTree = ""; 297 | }; 298 | EBA82A6D1D1D42D00089DF88 /* Test Doubles */ = { 299 | isa = PBXGroup; 300 | children = ( 301 | EBA82A6E1D1D42DB0089DF88 /* MockSuperHeroesAPIClient.swift */, 302 | ); 303 | name = "Test Doubles"; 304 | sourceTree = ""; 305 | }; 306 | EBA82A701D1D446F0089DF88 /* Extensions */ = { 307 | isa = PBXGroup; 308 | children = ( 309 | EBA82A711D1D44790089DF88 /* SuperHero.swift */, 310 | ); 311 | name = Extensions; 312 | sourceTree = ""; 313 | }; 314 | /* End PBXGroup section */ 315 | 316 | /* Begin PBXNativeTarget section */ 317 | EBA82A2E1D1D1F4E0089DF88 /* iOSBasicTraining */ = { 318 | isa = PBXNativeTarget; 319 | buildConfigurationList = EBA82A4C1D1D1F4E0089DF88 /* Build configuration list for PBXNativeTarget "iOSBasicTraining" */; 320 | buildPhases = ( 321 | 00B72D424DF0DD58548A49E7 /* [CP] Check Pods Manifest.lock */, 322 | EBA82A2B1D1D1F4E0089DF88 /* Sources */, 323 | EBA82A2C1D1D1F4E0089DF88 /* Frameworks */, 324 | EBA82A2D1D1D1F4E0089DF88 /* Resources */, 325 | 18411856403556C47F2015DE /* [CP] Embed Pods Frameworks */, 326 | BDE89FB4FF9F18E170E9157C /* [CP] Copy Pods Resources */, 327 | ); 328 | buildRules = ( 329 | ); 330 | dependencies = ( 331 | ); 332 | name = iOSBasicTraining; 333 | productName = iOSBasicTraining; 334 | productReference = EBA82A2F1D1D1F4E0089DF88 /* iOSBasicTraining.app */; 335 | productType = "com.apple.product-type.application"; 336 | }; 337 | EBA82A421D1D1F4E0089DF88 /* iOSBasicTrainingTests */ = { 338 | isa = PBXNativeTarget; 339 | buildConfigurationList = EBA82A4F1D1D1F4E0089DF88 /* Build configuration list for PBXNativeTarget "iOSBasicTrainingTests" */; 340 | buildPhases = ( 341 | 7E9A7A7FD01DA77BC67A72E2 /* [CP] Check Pods Manifest.lock */, 342 | EBA82A3F1D1D1F4E0089DF88 /* Sources */, 343 | EBA82A401D1D1F4E0089DF88 /* Frameworks */, 344 | EBA82A411D1D1F4E0089DF88 /* Resources */, 345 | DD4D1001220986F6C0B14A95 /* [CP] Embed Pods Frameworks */, 346 | 46C7BDFA0833B14C6C3D99B3 /* [CP] Copy Pods Resources */, 347 | ); 348 | buildRules = ( 349 | ); 350 | dependencies = ( 351 | EBA82A451D1D1F4E0089DF88 /* PBXTargetDependency */, 352 | ); 353 | name = iOSBasicTrainingTests; 354 | productName = iOSBasicTrainingTests; 355 | productReference = EBA82A431D1D1F4E0089DF88 /* iOSBasicTrainingTests.xctest */; 356 | productType = "com.apple.product-type.bundle.unit-test"; 357 | }; 358 | /* End PBXNativeTarget section */ 359 | 360 | /* Begin PBXProject section */ 361 | EBA82A271D1D1F4E0089DF88 /* Project object */ = { 362 | isa = PBXProject; 363 | attributes = { 364 | LastSwiftUpdateCheck = 0730; 365 | LastUpgradeCheck = 0730; 366 | ORGANIZATIONNAME = GoKarumi; 367 | TargetAttributes = { 368 | EBA82A2E1D1D1F4E0089DF88 = { 369 | CreatedOnToolsVersion = 7.3.1; 370 | }; 371 | EBA82A421D1D1F4E0089DF88 = { 372 | CreatedOnToolsVersion = 7.3.1; 373 | TestTargetID = EBA82A2E1D1D1F4E0089DF88; 374 | }; 375 | }; 376 | }; 377 | buildConfigurationList = EBA82A2A1D1D1F4E0089DF88 /* Build configuration list for PBXProject "iOSBasicTraining" */; 378 | compatibilityVersion = "Xcode 3.2"; 379 | developmentRegion = English; 380 | hasScannedForEncodings = 0; 381 | knownRegions = ( 382 | en, 383 | Base, 384 | ); 385 | mainGroup = EBA82A261D1D1F4E0089DF88; 386 | productRefGroup = EBA82A301D1D1F4E0089DF88 /* Products */; 387 | projectDirPath = ""; 388 | projectRoot = ""; 389 | targets = ( 390 | EBA82A2E1D1D1F4E0089DF88 /* iOSBasicTraining */, 391 | EBA82A421D1D1F4E0089DF88 /* iOSBasicTrainingTests */, 392 | ); 393 | }; 394 | /* End PBXProject section */ 395 | 396 | /* Begin PBXResourcesBuildPhase section */ 397 | EBA82A2D1D1D1F4E0089DF88 /* Resources */ = { 398 | isa = PBXResourcesBuildPhase; 399 | buildActionMask = 2147483647; 400 | files = ( 401 | EBA82A3D1D1D1F4E0089DF88 /* LaunchScreen.storyboard in Resources */, 402 | EBA82A3A1D1D1F4E0089DF88 /* Assets.xcassets in Resources */, 403 | EBA82A381D1D1F4E0089DF88 /* Main.storyboard in Resources */, 404 | ); 405 | runOnlyForDeploymentPostprocessing = 0; 406 | }; 407 | EBA82A411D1D1F4E0089DF88 /* Resources */ = { 408 | isa = PBXResourcesBuildPhase; 409 | buildActionMask = 2147483647; 410 | files = ( 411 | ); 412 | runOnlyForDeploymentPostprocessing = 0; 413 | }; 414 | /* End PBXResourcesBuildPhase section */ 415 | 416 | /* Begin PBXShellScriptBuildPhase section */ 417 | 00B72D424DF0DD58548A49E7 /* [CP] Check Pods Manifest.lock */ = { 418 | isa = PBXShellScriptBuildPhase; 419 | buildActionMask = 2147483647; 420 | files = ( 421 | ); 422 | inputPaths = ( 423 | ); 424 | name = "[CP] Check Pods Manifest.lock"; 425 | outputPaths = ( 426 | ); 427 | runOnlyForDeploymentPostprocessing = 0; 428 | shellPath = /bin/sh; 429 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 430 | showEnvVarsInLog = 0; 431 | }; 432 | 18411856403556C47F2015DE /* [CP] Embed Pods Frameworks */ = { 433 | isa = PBXShellScriptBuildPhase; 434 | buildActionMask = 2147483647; 435 | files = ( 436 | ); 437 | inputPaths = ( 438 | ); 439 | name = "[CP] Embed Pods Frameworks"; 440 | outputPaths = ( 441 | ); 442 | runOnlyForDeploymentPostprocessing = 0; 443 | shellPath = /bin/sh; 444 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-iOSBasicTraining/Pods-iOSBasicTraining-frameworks.sh\"\n"; 445 | showEnvVarsInLog = 0; 446 | }; 447 | 46C7BDFA0833B14C6C3D99B3 /* [CP] Copy Pods Resources */ = { 448 | isa = PBXShellScriptBuildPhase; 449 | buildActionMask = 2147483647; 450 | files = ( 451 | ); 452 | inputPaths = ( 453 | ); 454 | name = "[CP] Copy Pods Resources"; 455 | outputPaths = ( 456 | ); 457 | runOnlyForDeploymentPostprocessing = 0; 458 | shellPath = /bin/sh; 459 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-iOSBasicTrainingTests/Pods-iOSBasicTrainingTests-resources.sh\"\n"; 460 | showEnvVarsInLog = 0; 461 | }; 462 | 7E9A7A7FD01DA77BC67A72E2 /* [CP] Check Pods Manifest.lock */ = { 463 | isa = PBXShellScriptBuildPhase; 464 | buildActionMask = 2147483647; 465 | files = ( 466 | ); 467 | inputPaths = ( 468 | ); 469 | name = "[CP] Check Pods Manifest.lock"; 470 | outputPaths = ( 471 | ); 472 | runOnlyForDeploymentPostprocessing = 0; 473 | shellPath = /bin/sh; 474 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 475 | showEnvVarsInLog = 0; 476 | }; 477 | BDE89FB4FF9F18E170E9157C /* [CP] Copy Pods Resources */ = { 478 | isa = PBXShellScriptBuildPhase; 479 | buildActionMask = 2147483647; 480 | files = ( 481 | ); 482 | inputPaths = ( 483 | ); 484 | name = "[CP] Copy Pods Resources"; 485 | outputPaths = ( 486 | ); 487 | runOnlyForDeploymentPostprocessing = 0; 488 | shellPath = /bin/sh; 489 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-iOSBasicTraining/Pods-iOSBasicTraining-resources.sh\"\n"; 490 | showEnvVarsInLog = 0; 491 | }; 492 | DD4D1001220986F6C0B14A95 /* [CP] Embed Pods Frameworks */ = { 493 | isa = PBXShellScriptBuildPhase; 494 | buildActionMask = 2147483647; 495 | files = ( 496 | ); 497 | inputPaths = ( 498 | ); 499 | name = "[CP] Embed Pods Frameworks"; 500 | outputPaths = ( 501 | ); 502 | runOnlyForDeploymentPostprocessing = 0; 503 | shellPath = /bin/sh; 504 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-iOSBasicTrainingTests/Pods-iOSBasicTrainingTests-frameworks.sh\"\n"; 505 | showEnvVarsInLog = 0; 506 | }; 507 | /* End PBXShellScriptBuildPhase section */ 508 | 509 | /* Begin PBXSourcesBuildPhase section */ 510 | EBA82A2B1D1D1F4E0089DF88 /* Sources */ = { 511 | isa = PBXSourcesBuildPhase; 512 | buildActionMask = 2147483647; 513 | files = ( 514 | EB7945831D1D51D600115EC8 /* UIView.swift in Sources */, 515 | EB7945921D1D863500115EC8 /* SuperHeroDetailPresenter.swift in Sources */, 516 | EBA82A651D1D3AF30089DF88 /* SuperHeroesAPIClient.swift in Sources */, 517 | EBA82A681D1D3B670089DF88 /* CapturedSuperHeroesStorage.swift in Sources */, 518 | EBA82A6A1D1D3FE10089DF88 /* SuperHeroesDetectorError.swift in Sources */, 519 | EBA82A351D1D1F4E0089DF88 /* SuperHeroesViewController.swift in Sources */, 520 | EB7945801D1D4FDE00115EC8 /* SuperHeroDetailViewController.swift in Sources */, 521 | EB4737551D1FF1D10055956A /* SuperHeroesRepository.swift in Sources */, 522 | EB4737521D1FF0080055956A /* GetSuperHeroes.swift in Sources */, 523 | EBA82A591D1D26920089DF88 /* Comic.swift in Sources */, 524 | EB4737501D1FEFFD0055956A /* CaptureSuperHero.swift in Sources */, 525 | EB79458E1D1D85BD00115EC8 /* Presenter.swift in Sources */, 526 | EB7945901D1D862E00115EC8 /* SuperHeroesPresenter.swift in Sources */, 527 | EB7945941D1D882400115EC8 /* SuperHeroesDetectorViewController.swift in Sources */, 528 | EB7945851D1D744400115EC8 /* UIColor.swift in Sources */, 529 | EBA82A621D1D3AD10089DF88 /* SuperHeroesDetector.swift in Sources */, 530 | EB7945961D1D891500115EC8 /* SuperHeroesDetectorServiceLocator.swift in Sources */, 531 | EB7945981D1D90CB00115EC8 /* MarvelSuperHeroesAPIClient.swift in Sources */, 532 | EBA82A331D1D1F4E0089DF88 /* AppDelegate.swift in Sources */, 533 | EBA82A571D1D26180089DF88 /* SuperHero.swift in Sources */, 534 | EB7945881D1D753700115EC8 /* SuperHeroTableViewCell.swift in Sources */, 535 | ); 536 | runOnlyForDeploymentPostprocessing = 0; 537 | }; 538 | EBA82A3F1D1D1F4E0089DF88 /* Sources */ = { 539 | isa = PBXSourcesBuildPhase; 540 | buildActionMask = 2147483647; 541 | files = ( 542 | EBA82A721D1D44790089DF88 /* SuperHero.swift in Sources */, 543 | EBA82A6C1D1D422A0089DF88 /* SuperHeroesDetectorTests.swift in Sources */, 544 | EBA82A6F1D1D42DB0089DF88 /* MockSuperHeroesAPIClient.swift in Sources */, 545 | EBA82A5C1D1D26DB0089DF88 /* SuperHeroTests.swift in Sources */, 546 | EBA82A601D1D27E90089DF88 /* SuperHeroesBuilder.swift in Sources */, 547 | ); 548 | runOnlyForDeploymentPostprocessing = 0; 549 | }; 550 | /* End PBXSourcesBuildPhase section */ 551 | 552 | /* Begin PBXTargetDependency section */ 553 | EBA82A451D1D1F4E0089DF88 /* PBXTargetDependency */ = { 554 | isa = PBXTargetDependency; 555 | target = EBA82A2E1D1D1F4E0089DF88 /* iOSBasicTraining */; 556 | targetProxy = EBA82A441D1D1F4E0089DF88 /* PBXContainerItemProxy */; 557 | }; 558 | /* End PBXTargetDependency section */ 559 | 560 | /* Begin PBXVariantGroup section */ 561 | EBA82A361D1D1F4E0089DF88 /* Main.storyboard */ = { 562 | isa = PBXVariantGroup; 563 | children = ( 564 | EBA82A371D1D1F4E0089DF88 /* Base */, 565 | ); 566 | name = Main.storyboard; 567 | sourceTree = ""; 568 | }; 569 | EBA82A3B1D1D1F4E0089DF88 /* LaunchScreen.storyboard */ = { 570 | isa = PBXVariantGroup; 571 | children = ( 572 | EBA82A3C1D1D1F4E0089DF88 /* Base */, 573 | ); 574 | name = LaunchScreen.storyboard; 575 | sourceTree = ""; 576 | }; 577 | /* End PBXVariantGroup section */ 578 | 579 | /* Begin XCBuildConfiguration section */ 580 | EBA82A4A1D1D1F4E0089DF88 /* Debug */ = { 581 | isa = XCBuildConfiguration; 582 | buildSettings = { 583 | ALWAYS_SEARCH_USER_PATHS = NO; 584 | CLANG_ANALYZER_NONNULL = YES; 585 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 586 | CLANG_CXX_LIBRARY = "libc++"; 587 | CLANG_ENABLE_MODULES = YES; 588 | CLANG_ENABLE_OBJC_ARC = YES; 589 | CLANG_WARN_BOOL_CONVERSION = YES; 590 | CLANG_WARN_CONSTANT_CONVERSION = YES; 591 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 592 | CLANG_WARN_EMPTY_BODY = YES; 593 | CLANG_WARN_ENUM_CONVERSION = YES; 594 | CLANG_WARN_INT_CONVERSION = YES; 595 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 596 | CLANG_WARN_UNREACHABLE_CODE = YES; 597 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 598 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 599 | COPY_PHASE_STRIP = NO; 600 | DEBUG_INFORMATION_FORMAT = dwarf; 601 | ENABLE_STRICT_OBJC_MSGSEND = YES; 602 | ENABLE_TESTABILITY = YES; 603 | GCC_C_LANGUAGE_STANDARD = gnu99; 604 | GCC_DYNAMIC_NO_PIC = NO; 605 | GCC_NO_COMMON_BLOCKS = YES; 606 | GCC_OPTIMIZATION_LEVEL = 0; 607 | GCC_PREPROCESSOR_DEFINITIONS = ( 608 | "DEBUG=1", 609 | "$(inherited)", 610 | ); 611 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 612 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 613 | GCC_WARN_UNDECLARED_SELECTOR = YES; 614 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 615 | GCC_WARN_UNUSED_FUNCTION = YES; 616 | GCC_WARN_UNUSED_VARIABLE = YES; 617 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 618 | MTL_ENABLE_DEBUG_INFO = YES; 619 | ONLY_ACTIVE_ARCH = YES; 620 | SDKROOT = iphoneos; 621 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 622 | }; 623 | name = Debug; 624 | }; 625 | EBA82A4B1D1D1F4E0089DF88 /* Release */ = { 626 | isa = XCBuildConfiguration; 627 | buildSettings = { 628 | ALWAYS_SEARCH_USER_PATHS = NO; 629 | CLANG_ANALYZER_NONNULL = YES; 630 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 631 | CLANG_CXX_LIBRARY = "libc++"; 632 | CLANG_ENABLE_MODULES = YES; 633 | CLANG_ENABLE_OBJC_ARC = YES; 634 | CLANG_WARN_BOOL_CONVERSION = YES; 635 | CLANG_WARN_CONSTANT_CONVERSION = YES; 636 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 637 | CLANG_WARN_EMPTY_BODY = YES; 638 | CLANG_WARN_ENUM_CONVERSION = YES; 639 | CLANG_WARN_INT_CONVERSION = YES; 640 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 641 | CLANG_WARN_UNREACHABLE_CODE = YES; 642 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 643 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 644 | COPY_PHASE_STRIP = NO; 645 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 646 | ENABLE_NS_ASSERTIONS = NO; 647 | ENABLE_STRICT_OBJC_MSGSEND = YES; 648 | GCC_C_LANGUAGE_STANDARD = gnu99; 649 | GCC_NO_COMMON_BLOCKS = YES; 650 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 651 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 652 | GCC_WARN_UNDECLARED_SELECTOR = YES; 653 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 654 | GCC_WARN_UNUSED_FUNCTION = YES; 655 | GCC_WARN_UNUSED_VARIABLE = YES; 656 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 657 | MTL_ENABLE_DEBUG_INFO = NO; 658 | SDKROOT = iphoneos; 659 | VALIDATE_PRODUCT = YES; 660 | }; 661 | name = Release; 662 | }; 663 | EBA82A4D1D1D1F4E0089DF88 /* Debug */ = { 664 | isa = XCBuildConfiguration; 665 | baseConfigurationReference = 5BD0C264AFC720381E4CCD11 /* Pods-iOSBasicTraining.debug.xcconfig */; 666 | buildSettings = { 667 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 668 | INFOPLIST_FILE = iOSBasicTraining/Info.plist; 669 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 670 | PRODUCT_BUNDLE_IDENTIFIER = com.karumi.iOSBasicTraining; 671 | PRODUCT_NAME = "$(TARGET_NAME)"; 672 | }; 673 | name = Debug; 674 | }; 675 | EBA82A4E1D1D1F4E0089DF88 /* Release */ = { 676 | isa = XCBuildConfiguration; 677 | baseConfigurationReference = A23F24A9F3E00ED5C6923BAF /* Pods-iOSBasicTraining.release.xcconfig */; 678 | buildSettings = { 679 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 680 | INFOPLIST_FILE = iOSBasicTraining/Info.plist; 681 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 682 | PRODUCT_BUNDLE_IDENTIFIER = com.karumi.iOSBasicTraining; 683 | PRODUCT_NAME = "$(TARGET_NAME)"; 684 | }; 685 | name = Release; 686 | }; 687 | EBA82A501D1D1F4E0089DF88 /* Debug */ = { 688 | isa = XCBuildConfiguration; 689 | baseConfigurationReference = 6A04285918E4D5E401E2076E /* Pods-iOSBasicTrainingTests.debug.xcconfig */; 690 | buildSettings = { 691 | BUNDLE_LOADER = "$(TEST_HOST)"; 692 | CLANG_ENABLE_MODULES = YES; 693 | INFOPLIST_FILE = iOSBasicTrainingTests/Info.plist; 694 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 695 | PRODUCT_BUNDLE_IDENTIFIER = com.karumi.iOSBasicTrainingTests; 696 | PRODUCT_NAME = "$(TARGET_NAME)"; 697 | SWIFT_OBJC_BRIDGING_HEADER = "iOSBasicTrainingTests/iOSBasicTrainingTests-Bridging-Header.h"; 698 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 699 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOSBasicTraining.app/iOSBasicTraining"; 700 | }; 701 | name = Debug; 702 | }; 703 | EBA82A511D1D1F4E0089DF88 /* Release */ = { 704 | isa = XCBuildConfiguration; 705 | baseConfigurationReference = 38CDB279D2411D6931C099DA /* Pods-iOSBasicTrainingTests.release.xcconfig */; 706 | buildSettings = { 707 | BUNDLE_LOADER = "$(TEST_HOST)"; 708 | CLANG_ENABLE_MODULES = YES; 709 | INFOPLIST_FILE = iOSBasicTrainingTests/Info.plist; 710 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 711 | PRODUCT_BUNDLE_IDENTIFIER = com.karumi.iOSBasicTrainingTests; 712 | PRODUCT_NAME = "$(TARGET_NAME)"; 713 | SWIFT_OBJC_BRIDGING_HEADER = "iOSBasicTrainingTests/iOSBasicTrainingTests-Bridging-Header.h"; 714 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOSBasicTraining.app/iOSBasicTraining"; 715 | }; 716 | name = Release; 717 | }; 718 | /* End XCBuildConfiguration section */ 719 | 720 | /* Begin XCConfigurationList section */ 721 | EBA82A2A1D1D1F4E0089DF88 /* Build configuration list for PBXProject "iOSBasicTraining" */ = { 722 | isa = XCConfigurationList; 723 | buildConfigurations = ( 724 | EBA82A4A1D1D1F4E0089DF88 /* Debug */, 725 | EBA82A4B1D1D1F4E0089DF88 /* Release */, 726 | ); 727 | defaultConfigurationIsVisible = 0; 728 | defaultConfigurationName = Release; 729 | }; 730 | EBA82A4C1D1D1F4E0089DF88 /* Build configuration list for PBXNativeTarget "iOSBasicTraining" */ = { 731 | isa = XCConfigurationList; 732 | buildConfigurations = ( 733 | EBA82A4D1D1D1F4E0089DF88 /* Debug */, 734 | EBA82A4E1D1D1F4E0089DF88 /* Release */, 735 | ); 736 | defaultConfigurationIsVisible = 0; 737 | defaultConfigurationName = Release; 738 | }; 739 | EBA82A4F1D1D1F4E0089DF88 /* Build configuration list for PBXNativeTarget "iOSBasicTrainingTests" */ = { 740 | isa = XCConfigurationList; 741 | buildConfigurations = ( 742 | EBA82A501D1D1F4E0089DF88 /* Debug */, 743 | EBA82A511D1D1F4E0089DF88 /* Release */, 744 | ); 745 | defaultConfigurationIsVisible = 0; 746 | defaultConfigurationName = Release; 747 | }; 748 | /* End XCConfigurationList section */ 749 | }; 750 | rootObject = EBA82A271D1D1F4E0089DF88 /* Project object */; 751 | } 752 | -------------------------------------------------------------------------------- /iOSBasicTraining.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOSBasicTraining.xcodeproj/xcshareddata/xcschemes/iOSBasicTraining.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /iOSBasicTraining.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /iOSBasicTraining/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. 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 18 | launchOptions: [NSObject: AnyObject]?) -> Bool { 19 | window = UIWindow(frame:UIScreen.mainScreen().bounds) 20 | installRootViewControllerIntoWindow(window) 21 | configureWindow() 22 | configureNavigationBarStyle() 23 | window?.makeKeyAndVisible() 24 | return true 25 | } 26 | 27 | private func installRootViewControllerIntoWindow(window: UIWindow?) { 28 | let viewController = SuperHeroesDetectorServiceLocator.provideRootViewController() 29 | window?.rootViewController = viewController 30 | } 31 | 32 | private func configureWindow() { 33 | window?.backgroundColor = UIColor.windowBackgroundColor 34 | } 35 | 36 | private func configureNavigationBarStyle() { 37 | let navigationBarAppearance = UINavigationBar.appearance() 38 | navigationBarAppearance.barTintColor = UIColor.navigationBarColor 39 | navigationBarAppearance.tintColor = UIColor.navigationBarTitleColor 40 | navigationBarAppearance.translucent = false 41 | navigationBarAppearance.titleTextAttributes = [ 42 | NSForegroundColorAttributeName : UIColor.navigationBarTitleColor 43 | ] 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /iOSBasicTraining/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 | "size" : "40x40", 15 | "idiom" : "iphone", 16 | "filename" : "Icon-40@2x.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "size" : "40x40", 21 | "idiom" : "iphone", 22 | "filename" : "Icon-40@3x.png", 23 | "scale" : "3x" 24 | }, 25 | { 26 | "size" : "60x60", 27 | "idiom" : "iphone", 28 | "filename" : "Icon-60@2x.png", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "size" : "60x60", 33 | "idiom" : "iphone", 34 | "filename" : "Icon-60@3x.png", 35 | "scale" : "3x" 36 | }, 37 | { 38 | "idiom" : "ipad", 39 | "size" : "29x29", 40 | "scale" : "1x" 41 | }, 42 | { 43 | "idiom" : "ipad", 44 | "size" : "29x29", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "idiom" : "ipad", 49 | "size" : "40x40", 50 | "scale" : "1x" 51 | }, 52 | { 53 | "idiom" : "ipad", 54 | "size" : "40x40", 55 | "scale" : "2x" 56 | }, 57 | { 58 | "idiom" : "ipad", 59 | "size" : "76x76", 60 | "scale" : "1x" 61 | }, 62 | { 63 | "idiom" : "ipad", 64 | "size" : "76x76", 65 | "scale" : "2x" 66 | }, 67 | { 68 | "idiom" : "ipad", 69 | "size" : "83.5x83.5", 70 | "scale" : "2x" 71 | } 72 | ], 73 | "info" : { 74 | "version" : 1, 75 | "author" : "xcode" 76 | } 77 | } -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Karumi/iOSBasicTraining/d56b99b8589999f8f5137eb66c53f05ec3d115f6/iOSBasicTraining/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Karumi/iOSBasicTraining/d56b99b8589999f8f5137eb66c53f05ec3d115f6/iOSBasicTraining/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Karumi/iOSBasicTraining/d56b99b8589999f8f5137eb66c53f05ec3d115f6/iOSBasicTraining/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Karumi/iOSBasicTraining/d56b99b8589999f8f5137eb66c53f05ec3d115f6/iOSBasicTraining/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/ic_avenger_badge.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "ic_avengers.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/ic_avenger_badge.imageset/ic_avengers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Karumi/iOSBasicTraining/d56b99b8589999f8f5137eb66c53f05ec3d115f6/iOSBasicTraining/Assets.xcassets/ic_avenger_badge.imageset/ic_avengers.png -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/ic_karumi_logo.imageset/08_VERT + ALPHA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Karumi/iOSBasicTraining/d56b99b8589999f8f5137eb66c53f05ec3d115f6/iOSBasicTraining/Assets.xcassets/ic_karumi_logo.imageset/08_VERT + ALPHA.png -------------------------------------------------------------------------------- /iOSBasicTraining/Assets.xcassets/ic_karumi_logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "08_VERT + ALPHA.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /iOSBasicTraining/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 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /iOSBasicTraining/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ManifoldCF-Regular 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 81 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 141 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /iOSBasicTraining/CaptureSuperHero.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CaptureSuperHero.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente on 26/6/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Result 11 | 12 | class CaptureSuperHero { 13 | 14 | private let superHeroesDetector: SuperHeroesDetector 15 | 16 | init(superHeroesDetector: SuperHeroesDetector) { 17 | self.superHeroesDetector = superHeroesDetector 18 | } 19 | 20 | func capture(id: String) -> Result { 21 | return superHeroesDetector.captureSuperHero(id) 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /iOSBasicTraining/CapturedSuperHeroesStorage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CapturedSuperHeroesStorage.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class CapturedSuperHeroesStorage { 12 | 13 | private static let storageName = "CapturedSuperHeroesStorage" 14 | 15 | private let userDefaults: NSUserDefaults 16 | 17 | init() { 18 | userDefaults = NSUserDefaults.init(suiteName: CapturedSuperHeroesStorage.storageName)! 19 | } 20 | 21 | func isSuperHeroCaptured(superHeroId: String) -> Bool { 22 | return userDefaults.boolForKey(superHeroId) 23 | } 24 | 25 | func markSuperHeroAsCaptured(superHeroId: String) { 26 | userDefaults.setBool(true, forKey: superHeroId) 27 | } 28 | 29 | func clear() { 30 | for superHeroId in userDefaults.dictionaryRepresentation().keys { 31 | userDefaults.removeObjectForKey(superHeroId) 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /iOSBasicTraining/Comic.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Comic.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Comic { 12 | 13 | let name: String? 14 | 15 | } 16 | -------------------------------------------------------------------------------- /iOSBasicTraining/GetSuperHeroes.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GetSuperHeroes.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente on 26/6/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Result 11 | 12 | class GetSuperHeroes { 13 | 14 | private let superHeroesDetector: SuperHeroesDetector 15 | 16 | init(superHeroesDetector: SuperHeroesDetector) { 17 | self.superHeroesDetector = superHeroesDetector 18 | } 19 | 20 | func getAll(completion: (Result<[SuperHero], SuperHeroesDetectorError>) -> Void) { 21 | superHeroesDetector.getSuperHeroes { result in 22 | completion(result) 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /iOSBasicTraining/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | 10 | CFBundleDevelopmentRegion 11 | en 12 | CFBundleExecutable 13 | $(EXECUTABLE_NAME) 14 | CFBundleIdentifier 15 | $(PRODUCT_BUNDLE_IDENTIFIER) 16 | CFBundleInfoDictionaryVersion 17 | 6.0 18 | CFBundleName 19 | $(PRODUCT_NAME) 20 | CFBundlePackageType 21 | APPL 22 | CFBundleShortVersionString 23 | 1.0 24 | CFBundleSignature 25 | ???? 26 | CFBundleVersion 27 | 1 28 | LSRequiresIPhoneOS 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /iOSBasicTraining/MarvelSuperHeroesAPIClient.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MarvelSuperHeroesAPIClient.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Result 11 | import MarvelAPIClient 12 | 13 | class MarvelSuperHeroesAPIClient: SuperHeroesAPIClient { 14 | 15 | private let charactersAPIClient: CharactersAPIClient 16 | 17 | init() { 18 | MarvelAPIClient.configureCredentials( 19 | publicKey: "54355f684e1983a183d7bfec96a4bf81", 20 | privateKey: "4ad71e7b61e40311545909af0d6ebbd52bbfeae3") 21 | self.charactersAPIClient = MarvelAPIClient.charactersAPIClient 22 | } 23 | 24 | func getAllSuperHeroes(completion: (Result<[SuperHero], SuperHeroesDetectorError>) -> Void) { 25 | charactersAPIClient.getAll(offset: 0, limit: 20) { result in 26 | dispatch_async(dispatch_get_main_queue(), { 27 | switch result { 28 | case .Success(let characters): 29 | let superHeroes = self.mapSuperHeroes(characters) 30 | completion(Result(superHeroes)) 31 | break 32 | case .Failure: 33 | completion(Result(error: SuperHeroesDetectorError.ConnectionError)) 34 | } 35 | }) 36 | } 37 | } 38 | 39 | private func mapSuperHeroes(characters: GetCharactersDTO) -> [SuperHero] { 40 | guard let characters = characters.characters else { 41 | return [SuperHero]() 42 | } 43 | return characters.map { character in 44 | SuperHero(id: character.id, 45 | name: character.name ?? "", 46 | description: character.description, 47 | image: character.thumbnail?.URL(.LandscapeExtraLarge), 48 | comics: mapComics(character.comics)) 49 | } 50 | } 51 | 52 | private func mapComics(comics: [ComicDTO]?) -> [Comic] { 53 | guard let comics = comics else { 54 | return [Comic]() 55 | } 56 | return comics.map { comic in 57 | Comic(name: comic.name) 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /iOSBasicTraining/Presenter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Presenter.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol Presenter { 12 | 13 | func viewDidLoad() 14 | func viewWillAppear() 15 | 16 | } 17 | 18 | protocol View: class { 19 | 20 | func showMessage(message: String) 21 | 22 | } 23 | 24 | extension Presenter { 25 | 26 | func viewDidLoad() { } 27 | func viewWillAppear() { } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHero.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHero.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct SuperHero { 12 | 13 | let id: String 14 | let name: String 15 | let description: String? 16 | let image: NSURL? 17 | let comics: [Comic] 18 | 19 | var formalDescription: String { 20 | get { 21 | if let description = self.description where !description.isEmpty { 22 | return "\(name) - \(description)" 23 | } else { 24 | return "\(name) - No description provided." 25 | } 26 | } 27 | } 28 | 29 | func isAvenger() -> Bool { 30 | return id.containsString("4") 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroDetailPresenter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroDetailPresenter.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class SuperHeroDetailPresenter: Presenter { 12 | 13 | private weak var view: SuperHeroDetailView? 14 | private let captureSuperHero: CaptureSuperHero 15 | private let superHero: SuperHero 16 | 17 | init(view: SuperHeroDetailView, captureSuperHero: CaptureSuperHero, superHero: SuperHero) { 18 | self.view = view 19 | self.captureSuperHero = captureSuperHero 20 | self.superHero = superHero 21 | } 22 | 23 | func viewDidLoad() { 24 | view?.showSuperHero(superHero) 25 | } 26 | 27 | func didTapCaptureButton() { 28 | let id = superHero.id 29 | let result = captureSuperHero.capture(id) 30 | switch result { 31 | case .Success(_): 32 | view?.hideCaptureButton() 33 | view?.showMessage("Evil super hero captured!") 34 | break 35 | default: 36 | view?.showMessage("Ups, Something went wrong!") 37 | } 38 | } 39 | 40 | } 41 | 42 | protocol SuperHeroDetailView: View { 43 | 44 | func showSuperHero(superHero: SuperHero) 45 | func hideCaptureButton() 46 | 47 | } 48 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroDetailViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroDetailViewController.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import SDWebImage 12 | import Result 13 | 14 | class SuperHeroDetailViewController: SuperHeroesDetectorViewController, SuperHeroDetailView { 15 | 16 | @IBOutlet weak var photoImageView: UIImageView! 17 | @IBOutlet weak var nameLabel: UILabel! 18 | @IBOutlet weak var descriptionLabel: UILabel! 19 | @IBOutlet weak var avengersBadgeImageView: UIImageView! 20 | @IBOutlet weak var captureButton: UIButton! 21 | 22 | var presenter: SuperHeroDetailPresenter! 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | presenter.viewDidLoad() 27 | } 28 | 29 | @IBAction func didTapCaptureButton() { 30 | presenter.didTapCaptureButton() 31 | } 32 | 33 | func showSuperHero(superHero: SuperHero) { 34 | title = superHero.name.uppercaseString 35 | nameLabel.text = superHero.name 36 | descriptionLabel.text = superHero.formalDescription 37 | avengersBadgeImageView.hidden = !superHero.isAvenger() 38 | photoImageView.sd_setImageWithURL(superHero.image) 39 | } 40 | 41 | func hideCaptureButton() { 42 | captureButton.hidden = true 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroTableViewCell.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import SDWebImage 12 | 13 | class SuperHeroTableViewCell: UITableViewCell { 14 | 15 | @IBOutlet weak var photoImageView: UIImageView! 16 | @IBOutlet weak var nameLabel: UILabel! 17 | @IBOutlet weak var avengersBadgeImageView: UIImageView! 18 | 19 | func configureForHero(hero: SuperHero) { 20 | nameLabel.text = hero.name 21 | photoImageView.sd_setImageWithURL(hero.image) 22 | avengersBadgeImageView.hidden = !hero.isAvenger() 23 | applyImageGradient(photoImageView) 24 | } 25 | 26 | private func applyImageGradient(thumbnailImage: UIImageView) { 27 | guard thumbnailImage.layer.sublayers == nil else { 28 | return 29 | } 30 | let gradient: CAGradientLayer = CAGradientLayer(layer: thumbnailImage.layer) 31 | gradient.frame = thumbnailImage.bounds 32 | gradient.colors = [UIColor.gradientStartColor.CGColor, UIColor.gradientEndColor.CGColor] 33 | gradient.startPoint = CGPoint(x: 0.0, y: 0.6) 34 | gradient.endPoint = CGPoint(x: 0.0, y: 1.0) 35 | thumbnailImage.layer.insertSublayer(gradient, atIndex: 0) 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroesAPIClient.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesAPIClient.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Result 11 | 12 | protocol SuperHeroesAPIClient { 13 | 14 | func getAllSuperHeroes(completion: (Result<[SuperHero], SuperHeroesDetectorError>) -> Void) 15 | 16 | } 17 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroesDetector.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesDetector.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Result 11 | 12 | class SuperHeroesDetector { 13 | 14 | private let superHeroesRepository: SuperHeroesRepository 15 | 16 | init(superHeroesRepository: SuperHeroesRepository) { 17 | self.superHeroesRepository = superHeroesRepository 18 | } 19 | 20 | func getSuperHeroes(completion: (Result<[SuperHero], SuperHeroesDetectorError>) -> Void) { 21 | superHeroesRepository.getAll { result in 22 | completion(result) 23 | } 24 | } 25 | 26 | func captureSuperHero(id: String) -> Result { 27 | guard !id.isEmpty else { 28 | return Result(error: SuperHeroesDetectorError.SuperHeroNotFound) 29 | } 30 | return superHeroesRepository.markSuperHeroAsCaptured(id) 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroesDetectorError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesDetectorError.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum SuperHeroesDetectorError: ErrorType { 12 | 13 | case ConnectionError 14 | case SuperHeroNotFound 15 | 16 | } 17 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroesDetectorServiceLocator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesDetectorServiceLocator.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class SuperHeroesDetectorServiceLocator { 13 | 14 | static func provideRootViewController() -> UIViewController { 15 | let viewController = storyBoard.instantiateInitialViewController() as! SuperHeroesViewController 16 | let getSuperHeroes = provideGetSuperHeroesUseCase() 17 | viewController.presenter = SuperHeroesPresenter(view: viewController, 18 | getSuperHeroes: getSuperHeroes) 19 | return UINavigationController(rootViewController: viewController) 20 | } 21 | 22 | static func provideSuperHeroDetailViewController(superHero: SuperHero) -> UIViewController { 23 | let viewController = provideUIViewControllerWithName("SuperHeroDetailViewController") as! SuperHeroDetailViewController 24 | let captureSuperHero = provideCaptureSuperHeroUseCase() 25 | viewController.presenter = SuperHeroDetailPresenter(view: viewController, 26 | captureSuperHero: captureSuperHero, 27 | superHero: superHero) 28 | return viewController 29 | } 30 | 31 | private static func provideUIViewControllerWithName(name: String) -> UIViewController { 32 | return storyBoard.instantiateViewControllerWithIdentifier(name) 33 | } 34 | 35 | private static func provideGetSuperHeroesUseCase() -> GetSuperHeroes { 36 | let detector = provideSuperHeroesDetector() 37 | return GetSuperHeroes(superHeroesDetector: detector) 38 | } 39 | 40 | private static func provideCaptureSuperHeroUseCase() -> CaptureSuperHero { 41 | let detector = provideSuperHeroesDetector() 42 | return CaptureSuperHero(superHeroesDetector: detector) 43 | } 44 | 45 | private static func provideSuperHeroesDetector() -> SuperHeroesDetector { 46 | let repository = provideSuperHeroesRepository() 47 | return SuperHeroesDetector(superHeroesRepository: repository) 48 | } 49 | 50 | private static func provideSuperHeroesRepository() -> SuperHeroesRepository { 51 | let apiClient = provideSuperHeroesAPIClient() 52 | return SuperHeroesRepository(apiClient: apiClient, 53 | capturedSuperHeroesStorage: CapturedSuperHeroesStorage()) 54 | } 55 | 56 | private static func provideSuperHeroesAPIClient() -> SuperHeroesAPIClient { 57 | return MarvelSuperHeroesAPIClient() 58 | } 59 | 60 | private static var storyBoard: UIStoryboard = { 61 | return UIStoryboard(name: "Main", bundle: NSBundle.mainBundle()) 62 | }() 63 | 64 | } 65 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroesDetectorViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesDetectorViewController.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import Toast 12 | 13 | class SuperHeroesDetectorViewController: UIViewController, View { 14 | 15 | func showMessage(message: String) { 16 | view.makeToast(message) 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroesPresenter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesPresenter.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class SuperHeroesPresenter: Presenter { 12 | 13 | private weak var view: SuperHeroesView? 14 | private let getSuperHeroes: GetSuperHeroes 15 | 16 | init(view: SuperHeroesView, getSuperHeroes: GetSuperHeroes) { 17 | self.view = view 18 | self.getSuperHeroes = getSuperHeroes 19 | } 20 | 21 | func viewWillAppear() { 22 | loadSuperHeroes() 23 | } 24 | 25 | private func loadSuperHeroes() { 26 | view?.showLoading() 27 | getSuperHeroes.getAll { result in 28 | self.view?.hideLoading() 29 | switch result { 30 | case .Success(let superHeroes): 31 | self.showSuperHeroes(superHeroes) 32 | break 33 | case .Failure(let error): 34 | self.showError(error) 35 | break 36 | } 37 | } 38 | } 39 | 40 | private func showSuperHeroes(superHeroes: [SuperHero]) { 41 | view?.hideLoading() 42 | view?.superHeroes = superHeroes 43 | view?.showingEmptyCase = superHeroes.isEmpty 44 | view?.showingErrorCase = false 45 | } 46 | 47 | private func showError(error: SuperHeroesDetectorError) { 48 | guard let view = view else { 49 | return 50 | } 51 | view.hideLoading() 52 | view.showingEmptyCase = false 53 | switch error { 54 | case .ConnectionError: 55 | view.showingErrorCase = view.superHeroes.isEmpty 56 | if !view.superHeroes.isEmpty { 57 | view.showMessage("Ups, there is no connection!") 58 | } 59 | break 60 | default: 61 | if view.superHeroes.isEmpty { 62 | view.showingErrorCase = true 63 | } else { 64 | view.showMessage("Ups, unknown error detected!") 65 | } 66 | fatalError() 67 | } 68 | } 69 | 70 | } 71 | 72 | protocol SuperHeroesView: View { 73 | 74 | var showingEmptyCase: Bool { get set } 75 | var showingErrorCase: Bool { get set } 76 | var superHeroes: [SuperHero] { get set } 77 | 78 | func showLoading() 79 | func hideLoading() 80 | 81 | } 82 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroesRepository.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesRepository.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente on 26/6/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Result 11 | 12 | class SuperHeroesRepository { 13 | 14 | private let apiClient: SuperHeroesAPIClient 15 | private let capturedSuperHeroesStorage: CapturedSuperHeroesStorage 16 | 17 | init(apiClient: SuperHeroesAPIClient, capturedSuperHeroesStorage: CapturedSuperHeroesStorage) { 18 | self.apiClient = apiClient 19 | self.capturedSuperHeroesStorage = capturedSuperHeroesStorage 20 | } 21 | 22 | func getAll(completion: (Result<[SuperHero], SuperHeroesDetectorError>) -> Void) { 23 | return apiClient.getAllSuperHeroes { result in 24 | switch result { 25 | case .Success(let superHeroes): 26 | let nonCapturedSuperHeroes = superHeroes.filter { 27 | !self.capturedSuperHeroesStorage.isSuperHeroCaptured($0.id) 28 | } 29 | completion(Result(nonCapturedSuperHeroes)) 30 | break 31 | case .Failure(let apiClientError): 32 | completion(Result(error: apiClientError)) 33 | } 34 | } 35 | } 36 | 37 | func markSuperHeroAsCaptured(id: String) -> Result { 38 | capturedSuperHeroesStorage.markSuperHeroAsCaptured(id) 39 | return Result(id) 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /iOSBasicTraining/SuperHeroesViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Toast 11 | 12 | class SuperHeroesViewController: SuperHeroesDetectorViewController, 13 | UITableViewDataSource, UITableViewDelegate, SuperHeroesView { 14 | 15 | @IBOutlet weak var tableView: UITableView! 16 | @IBOutlet weak var emptyCaseView: UIView! 17 | @IBOutlet weak var errorCaseView: UIView! 18 | @IBOutlet weak var activityIndicatorView: UIActivityIndicatorView! 19 | 20 | var presenter: SuperHeroesPresenter! 21 | 22 | var superHeroes = [SuperHero]() { 23 | didSet { 24 | tableView.reloadData() 25 | } 26 | } 27 | 28 | var showingEmptyCase: Bool { 29 | get { 30 | return !emptyCaseView.hidden 31 | } 32 | set { 33 | emptyCaseView.hidden = !newValue 34 | } 35 | } 36 | 37 | var showingErrorCase: Bool { 38 | get { 39 | return !errorCaseView.hidden 40 | } 41 | set { 42 | errorCaseView.hidden = !newValue 43 | } 44 | } 45 | 46 | override func viewDidLoad() { 47 | super.viewDidLoad() 48 | configureNavigationBarTitle() 49 | configureTableView() 50 | configureNavigationBarBackButton() 51 | } 52 | 53 | override func viewWillAppear(animated: Bool) { 54 | super.viewWillAppear(animated) 55 | presenter.viewWillAppear() 56 | } 57 | 58 | func showLoading() { 59 | activityIndicatorView.startAnimating() 60 | activityIndicatorView.hidden = false 61 | } 62 | 63 | func hideLoading() { 64 | activityIndicatorView.stopAnimating() 65 | activityIndicatorView.hidden = true 66 | } 67 | 68 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 69 | return superHeroes.count 70 | } 71 | 72 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 73 | let cell = tableView.dequeueReusableCellWithIdentifier("SuperHeroTableViewCell", forIndexPath: indexPath) as! SuperHeroTableViewCell 74 | let hero = superHeroes[indexPath.row] 75 | cell.configureForHero(hero) 76 | return cell 77 | } 78 | 79 | func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 80 | let superHero = superHeroes[indexPath.row] 81 | let viewController = SuperHeroesDetectorServiceLocator.provideSuperHeroDetailViewController(superHero) 82 | navigationController?.pushViewController(viewController, animated: true) 83 | } 84 | 85 | 86 | private func configureNavigationBarTitle() { 87 | title = "Super Heroes Detector" 88 | } 89 | 90 | private func configureTableView() { 91 | tableView.dataSource = self 92 | tableView.delegate = self 93 | tableView.tableFooterView = UIView() 94 | } 95 | 96 | private func configureNavigationBarBackButton() { 97 | navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.Plain, target:nil, action:nil) 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /iOSBasicTraining/UIColor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | extension UIColor { 13 | 14 | convenience init(rgba: String) { 15 | var red: CGFloat = 0.0 16 | var green: CGFloat = 0.0 17 | var blue: CGFloat = 0.0 18 | var alpha: CGFloat = 1.0 19 | 20 | if rgba.hasPrefix("#") { 21 | let index = rgba.startIndex.advancedBy(1) 22 | let hex = rgba.substringFromIndex(index) 23 | let scanner = NSScanner(string: hex) 24 | var hexValue: CUnsignedLongLong = 0 25 | if scanner.scanHexLongLong(&hexValue) { 26 | switch hex.characters.count { 27 | case 3: 28 | red = CGFloat((hexValue & 0xF00) >> 8) / 15.0 29 | green = CGFloat((hexValue & 0x0F0) >> 4) / 15.0 30 | blue = CGFloat(hexValue & 0x00F) / 15.0 31 | case 4: 32 | red = CGFloat((hexValue & 0xF000) >> 12) / 15.0 33 | green = CGFloat((hexValue & 0x0F00) >> 8) / 15.0 34 | blue = CGFloat((hexValue & 0x00F0) >> 4) / 15.0 35 | alpha = CGFloat(hexValue & 0x000F) / 15.0 36 | case 6: 37 | red = CGFloat((hexValue & 0xFF0000) >> 16) / 255.0 38 | green = CGFloat((hexValue & 0x00FF00) >> 8) / 255.0 39 | blue = CGFloat(hexValue & 0x0000FF) / 255.0 40 | case 8: 41 | red = CGFloat((hexValue & 0xFF000000) >> 24) / 255.0 42 | green = CGFloat((hexValue & 0x00FF0000) >> 16) / 255.0 43 | blue = CGFloat((hexValue & 0x0000FF00) >> 8) / 255.0 44 | alpha = CGFloat(hexValue & 0x000000FF) / 255.0 45 | default: 46 | print("Invalid RGB string") 47 | } 48 | } else { 49 | print("Scan hex error") 50 | } 51 | } else { 52 | print("Invalid RGB string, missing '#' as prefix", terminator: "") 53 | } 54 | 55 | self.init(red:red, green:green, blue:blue, alpha:alpha) 56 | } 57 | 58 | static var windowBackgroundColor: UIColor { 59 | return UIColor(rgba: "#22282FFF") 60 | } 61 | static var loadingColor: UIColor { 62 | return UIColor(rgba: "#4D5B69FF") 63 | } 64 | 65 | static var tabBarColor: UIColor { 66 | return UIColor(rgba: "#4D5B69FF") 67 | } 68 | 69 | static var tabBarTintColor: UIColor { 70 | return UIColor(rgba: "#17D1FFFF") 71 | } 72 | 73 | static var navigationBarColor: UIColor { 74 | return UIColor(rgba: "#404B57FF") 75 | } 76 | 77 | static var navigationBarTitleColor: UIColor { 78 | return UIColor(rgba: "#F5F5F5FF") 79 | } 80 | 81 | static var gradientStartColor: UIColor { 82 | return UIColor(rgba: "#2C343C00") 83 | } 84 | 85 | static var gradientEndColor: UIColor { 86 | return UIColor(rgba: "#2C343CE5") 87 | } 88 | 89 | static var cellBackgroundColor: UIColor { 90 | return UIColor(rgba: "#22282fFF") 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /iOSBasicTraining/UIView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | extension UIView { 13 | 14 | func setRoundedCorners() { 15 | cornerRadius = self.bounds.height / CGFloat(2) 16 | } 17 | 18 | @IBInspectable var cornerRadius: CGFloat { 19 | get { 20 | return layer.cornerRadius 21 | } 22 | set { 23 | layer.cornerRadius = newValue 24 | layer.masksToBounds = newValue > 0 25 | } 26 | } 27 | 28 | @IBInspectable var borderWidth: CGFloat { 29 | get { 30 | return layer.borderWidth 31 | } 32 | set { 33 | layer.borderWidth = newValue 34 | } 35 | } 36 | 37 | @IBInspectable var borderColor: UIColor? { 38 | get { 39 | if let color = layer.borderColor { 40 | return UIColor(CGColor: color) 41 | } 42 | 43 | return nil 44 | } 45 | set { 46 | layer.borderColor = newValue?.CGColor 47 | } 48 | } 49 | 50 | func removeSubviews() { 51 | for view in subviews { 52 | view.removeFromSuperview() 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /iOSBasicTrainingTests/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 | -------------------------------------------------------------------------------- /iOSBasicTrainingTests/MockSuperHeroesAPIClient.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockSuperHeroesAPIClient.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Result 11 | @testable import iOSBasicTraining 12 | 13 | class MockSuperHeroesAPIClient: SuperHeroesAPIClient { 14 | 15 | var superHeroes: [SuperHero]? 16 | var getSuperHeroesError: SuperHeroesDetectorError? 17 | 18 | func getAllSuperHeroes(completion: (Result<[SuperHero], SuperHeroesDetectorError>) -> Void) { 19 | if let superHeroes = superHeroes { 20 | completion(Result(superHeroes)) 21 | } else if let getSuperHeroesError = getSuperHeroesError { 22 | completion(Result(error: getSuperHeroesError)) 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /iOSBasicTrainingTests/SuperHero.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHero.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | @testable import iOSBasicTraining 11 | 12 | extension SuperHero: Equatable { 13 | 14 | } 15 | 16 | func == (lhs: SuperHero, rhs: SuperHero) -> Bool { 17 | return lhs.id == rhs.id 18 | } 19 | -------------------------------------------------------------------------------- /iOSBasicTrainingTests/SuperHeroTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroTests.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Nimble 11 | import XCTest 12 | @testable import iOSBasicTraining 13 | 14 | class SuperHeroesTests: XCTestCase { 15 | 16 | 17 | func testASuperHeroIsAnAvengerIfTheIdContainsTheNumberFour() { 18 | let superHero = SuperHeroesBuilder.with(id: "1234") 19 | 20 | let isAvenger = superHero.isAvenger() 21 | 22 | expect(isAvenger).to(beTrue()) 23 | } 24 | 25 | func testASuperHeroIsNotAnAvengerIfTheIdDoesNotContainTheNumberFour() { 26 | let superHero = SuperHeroesBuilder.with(id: "123") 27 | 28 | let isAvenger = superHero.isAvenger() 29 | 30 | expect(isAvenger).to(beFalse()) 31 | } 32 | 33 | func testTheSuperHeroFormalDescriptionIsComposedByTheNameAndTheRegularDescription() { 34 | let name = "The Flash" 35 | let description = "The fastest man alive!" 36 | let superHero = SuperHeroesBuilder.with(name: name, description: description) 37 | 38 | let formalDescription = superHero.formalDescription 39 | 40 | expect(formalDescription).to(equal("\(name) - \(description)")) 41 | } 42 | 43 | func testTheSuperHeroFormalDescriptionShouldIndicateTheDescriptionIsNotProvidedIfTheValueIsNil() { 44 | let name = "3D Man" 45 | let superHero = SuperHeroesBuilder.with(name: name, description: nil) 46 | 47 | let formalDescription = superHero.formalDescription 48 | 49 | expect(formalDescription).to(equal("\(name) - No description provided.")) 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /iOSBasicTrainingTests/SuperHeroesBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesBuilder.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | @testable import iOSBasicTraining 11 | 12 | class SuperHeroesBuilder { 13 | 14 | static func with(id id: String = "1", 15 | name: String = "The Flash", 16 | description: String? = nil, 17 | image: NSURL? = nil, 18 | comics: [Comic] = [Comic]()) -> SuperHero { 19 | return SuperHero(id: id, name: name, description: description, image: image, comics: comics) 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /iOSBasicTrainingTests/SuperHeroesDetectorTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SuperHeroesDetectorTests.swift 3 | // iOSBasicTraining 4 | // 5 | // Created by Pedro Vicente Gomez on 24/06/16. 6 | // Copyright © 2016 GoKarumi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import XCTest 11 | import Nimble 12 | import Result 13 | @testable import iOSBasicTraining 14 | 15 | class SuperHeroesDetectorTests: XCTestCase { 16 | 17 | private let storage = CapturedSuperHeroesStorage() 18 | private let apiClient = MockSuperHeroesAPIClient() 19 | 20 | override func tearDown() { 21 | storage.clear() 22 | super.tearDown() 23 | } 24 | 25 | func testRetunsSuperHeroesObtainedFromTheAPIIfNoOneHasBeenMarkedAsCaptured() { 26 | let apiSuperHeroes = givenThereAreSomeSuperHeroes() 27 | let superHeroesDetector = givenASuperHeroesDetector() 28 | 29 | var result: Result<[SuperHero], SuperHeroesDetectorError>? 30 | superHeroesDetector.getSuperHeroes { response in 31 | result = response 32 | } 33 | 34 | expect(result?.value).toEventually(equal(apiSuperHeroes)) 35 | } 36 | 37 | func testReturnsConnectionErrorIfThereIsNoConnectionRetrieveingSuperHeroes() { 38 | givenThereIsNoConnection() 39 | let superHeroesDetector = givenASuperHeroesDetector() 40 | 41 | var result: Result<[SuperHero], SuperHeroesDetectorError>? 42 | superHeroesDetector.getSuperHeroes { response in 43 | result = response 44 | } 45 | 46 | expect(result?.error).toEventually(equal(SuperHeroesDetectorError.ConnectionError)) 47 | } 48 | 49 | func testReturnsAnEmptyListOfSuperHeroesIfThereAreNoSuperHeroes() { 50 | givenThereAreNoSuperHeroes() 51 | let superHeroesDetector = givenASuperHeroesDetector() 52 | 53 | var result: Result<[SuperHero], SuperHeroesDetectorError>? 54 | superHeroesDetector.getSuperHeroes { response in 55 | result = response 56 | } 57 | 58 | expect(result?.value).toEventually(beEmpty()) 59 | } 60 | 61 | func testDoesNotReturnSuperHeroesMarkedAsCaptured() { 62 | let superHeroesDetector = givenASuperHeroesDetector() 63 | let apiSuperHeroes = givenThereAreSomeSuperHeroes(5) 64 | 65 | superHeroesDetector.captureSuperHero(apiSuperHeroes[3].id) 66 | var result: Result<[SuperHero], SuperHeroesDetectorError>? 67 | superHeroesDetector.getSuperHeroes { response in 68 | result = response 69 | } 70 | 71 | expect(result?.value?.count).toEventually(equal(4)) 72 | expect(result?.value).toEventuallyNot(contain(apiSuperHeroes[3])) 73 | expect(result?.value).toEventually(contain(apiSuperHeroes[0])) 74 | expect(result?.value).toEventually(contain(apiSuperHeroes[1])) 75 | expect(result?.value).toEventually(contain(apiSuperHeroes[2])) 76 | expect(result?.value).toEventually(contain(apiSuperHeroes[4])) 77 | } 78 | 79 | private func givenThereAreNoSuperHeroes() { 80 | givenThereAreSomeSuperHeroes(0) 81 | } 82 | 83 | private func givenThereIsNoConnection() { 84 | apiClient.getSuperHeroesError = .ConnectionError 85 | } 86 | 87 | private func givenThereAreSomeSuperHeroes(numberOfSuperHeroes: Int = 10) -> [SuperHero] { 88 | var superHeroes = [SuperHero]() 89 | for i in 0.. SuperHeroesDetector { 100 | let repository = SuperHeroesRepository(apiClient: apiClient, capturedSuperHeroesStorage: storage) 101 | return SuperHeroesDetector(superHeroesRepository: repository) 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /iOSBasicTrainingTests/iOSBasicTrainingTests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | --------------------------------------------------------------------------------