├── .gitattributes ├── .gitignore ├── Assets ├── banner.png ├── banner.psd └── logo.ai ├── LICENSE.txt ├── Package.swift ├── README.md ├── Roman.playground ├── Contents.swift ├── contents.xcplayground ├── playground.xcworkspace │ └── contents.xcworkspacedata └── timeline.xctimeline ├── Roman.podspec ├── Roman.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── Roman OSX.xcscheme │ ├── Roman iOS.xcscheme │ ├── Roman tvOS.xcscheme │ └── Roman watchOS.xcscheme ├── Sources └── Roman.swift ├── Support └── Info.plist ├── Tests ├── Info.plist └── RomanTests.swift ├── Vagrantfile └── bootstrap.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | *.ai binary 2 | *.pdf binary 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/osx,linux,swift,vagrant 3 | 4 | ### OSX ### 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | 9 | # Icon must end with two \r 10 | Icon 11 | 12 | # Thumbnails 13 | ._* 14 | 15 | # Files that might appear in the root of a volume 16 | .DocumentRevisions-V100 17 | .fseventsd 18 | .Spotlight-V100 19 | .TemporaryItems 20 | .Trashes 21 | .VolumeIcon.icns 22 | 23 | # Directories potentially created on remote AFP share 24 | .AppleDB 25 | .AppleDesktop 26 | Network Trash Folder 27 | Temporary Items 28 | .apdisk 29 | 30 | 31 | ### Linux ### 32 | *~ 33 | 34 | # temporary files which can be created if a process still has a handle open of a deleted file 35 | .fuse_hidden* 36 | 37 | # KDE directory preferences 38 | .directory 39 | 40 | # Linux trash folder which might appear on any partition or disk 41 | .Trash-* 42 | 43 | 44 | ### Swift ### 45 | # Xcode 46 | # 47 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 48 | 49 | ## Build generated 50 | build/ 51 | DerivedData 52 | 53 | ## Various settings 54 | *.pbxuser 55 | !default.pbxuser 56 | *.mode1v3 57 | !default.mode1v3 58 | *.mode2v3 59 | !default.mode2v3 60 | *.perspectivev3 61 | !default.perspectivev3 62 | xcuserdata 63 | 64 | ## Other 65 | *.xccheckout 66 | *.moved-aside 67 | *.xcuserstate 68 | *.xcscmblueprint 69 | 70 | ## Obj-C/Swift specific 71 | *.hmap 72 | *.ipa 73 | 74 | # Swift Package Manager 75 | # 76 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 77 | # Packages/ 78 | .build/ 79 | 80 | # CocoaPods 81 | # 82 | # We recommend against adding the Pods directory to your .gitignore. However 83 | # you should judge for yourself, the pros and cons are mentioned at: 84 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 85 | # 86 | # Pods/ 87 | 88 | # Carthage 89 | # 90 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 91 | # Carthage/Checkouts 92 | 93 | Carthage/Build 94 | 95 | # fastlane 96 | # 97 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 98 | # screenshots whenever they are needed. 99 | # For more information about the recommended setup visit: 100 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 101 | 102 | fastlane/report.xml 103 | fastlane/screenshots 104 | 105 | 106 | ### Vagrant ### 107 | .vagrant/ 108 | 109 | -------------------------------------------------------------------------------- /Assets/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nvzqz/Roman/e29909635d798b586c3b59f8c74c644ae7093a19/Assets/banner.png -------------------------------------------------------------------------------- /Assets/banner.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nvzqz/Roman/e29909635d798b586c3b59f8c74c644ae7093a19/Assets/banner.psd -------------------------------------------------------------------------------- /Assets/logo.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nvzqz/Roman/e29909635d798b586c3b59f8c74c644ae7093a19/Assets/logo.ai -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | * Roman: 3 | ================================================================================ 4 | 5 | The MIT License (MIT) 6 | 7 | Copyright (c) 2016 Nikolai Vazquez 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | 27 | ================================================================================ 28 | * Roman Assets: 29 | ================================================================================ 30 | 31 | Attribution-ShareAlike 4.0 International 32 | 33 | ======================================================================= 34 | 35 | Creative Commons Corporation ("Creative Commons") is not a law firm and 36 | does not provide legal services or legal advice. Distribution of 37 | Creative Commons public licenses does not create a lawyer-client or 38 | other relationship. Creative Commons makes its licenses and related 39 | information available on an "as-is" basis. Creative Commons gives no 40 | warranties regarding its licenses, any material licensed under their 41 | terms and conditions, or any related information. Creative Commons 42 | disclaims all liability for damages resulting from their use to the 43 | fullest extent possible. 44 | 45 | Using Creative Commons Public Licenses 46 | 47 | Creative Commons public licenses provide a standard set of terms and 48 | conditions that creators and other rights holders may use to share 49 | original works of authorship and other material subject to copyright 50 | and certain other rights specified in the public license below. The 51 | following considerations are for informational purposes only, are not 52 | exhaustive, and do not form part of our licenses. 53 | 54 | Considerations for licensors: Our public licenses are 55 | intended for use by those authorized to give the public 56 | permission to use material in ways otherwise restricted by 57 | copyright and certain other rights. Our licenses are 58 | irrevocable. Licensors should read and understand the terms 59 | and conditions of the license they choose before applying it. 60 | Licensors should also secure all rights necessary before 61 | applying our licenses so that the public can reuse the 62 | material as expected. Licensors should clearly mark any 63 | material not subject to the license. This includes other CC- 64 | licensed material, or material used under an exception or 65 | limitation to copyright. More considerations for licensors: 66 | wiki.creativecommons.org/Considerations_for_licensors 67 | 68 | Considerations for the public: By using one of our public 69 | licenses, a licensor grants the public permission to use the 70 | licensed material under specified terms and conditions. If 71 | the licensor's permission is not necessary for any reason--for 72 | example, because of any applicable exception or limitation to 73 | copyright--then that use is not regulated by the license. Our 74 | licenses grant only permissions under copyright and certain 75 | other rights that a licensor has authority to grant. Use of 76 | the licensed material may still be restricted for other 77 | reasons, including because others have copyright or other 78 | rights in the material. A licensor may make special requests, 79 | such as asking that all changes be marked or described. 80 | Although not required by our licenses, you are encouraged to 81 | respect those requests where reasonable. More_considerations 82 | for the public: 83 | wiki.creativecommons.org/Considerations_for_licensees 84 | 85 | ======================================================================= 86 | 87 | Creative Commons Attribution-ShareAlike 4.0 International Public 88 | License 89 | 90 | By exercising the Licensed Rights (defined below), You accept and agree 91 | to be bound by the terms and conditions of this Creative Commons 92 | Attribution-ShareAlike 4.0 International Public License ("Public 93 | License"). To the extent this Public License may be interpreted as a 94 | contract, You are granted the Licensed Rights in consideration of Your 95 | acceptance of these terms and conditions, and the Licensor grants You 96 | such rights in consideration of benefits the Licensor receives from 97 | making the Licensed Material available under these terms and 98 | conditions. 99 | 100 | 101 | Section 1 -- Definitions. 102 | 103 | a. Adapted Material means material subject to Copyright and Similar 104 | Rights that is derived from or based upon the Licensed Material 105 | and in which the Licensed Material is translated, altered, 106 | arranged, transformed, or otherwise modified in a manner requiring 107 | permission under the Copyright and Similar Rights held by the 108 | Licensor. For purposes of this Public License, where the Licensed 109 | Material is a musical work, performance, or sound recording, 110 | Adapted Material is always produced where the Licensed Material is 111 | synched in timed relation with a moving image. 112 | 113 | b. Adapter's License means the license You apply to Your Copyright 114 | and Similar Rights in Your contributions to Adapted Material in 115 | accordance with the terms and conditions of this Public License. 116 | 117 | c. BY-SA Compatible License means a license listed at 118 | creativecommons.org/compatiblelicenses, approved by Creative 119 | Commons as essentially the equivalent of this Public License. 120 | 121 | d. Copyright and Similar Rights means copyright and/or similar rights 122 | closely related to copyright including, without limitation, 123 | performance, broadcast, sound recording, and Sui Generis Database 124 | Rights, without regard to how the rights are labeled or 125 | categorized. For purposes of this Public License, the rights 126 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 127 | Rights. 128 | 129 | e. Effective Technological Measures means those measures that, in the 130 | absence of proper authority, may not be circumvented under laws 131 | fulfilling obligations under Article 11 of the WIPO Copyright 132 | Treaty adopted on December 20, 1996, and/or similar international 133 | agreements. 134 | 135 | f. Exceptions and Limitations means fair use, fair dealing, and/or 136 | any other exception or limitation to Copyright and Similar Rights 137 | that applies to Your use of the Licensed Material. 138 | 139 | g. License Elements means the license attributes listed in the name 140 | of a Creative Commons Public License. The License Elements of this 141 | Public License are Attribution and ShareAlike. 142 | 143 | h. Licensed Material means the artistic or literary work, database, 144 | or other material to which the Licensor applied this Public 145 | License. 146 | 147 | i. Licensed Rights means the rights granted to You subject to the 148 | terms and conditions of this Public License, which are limited to 149 | all Copyright and Similar Rights that apply to Your use of the 150 | Licensed Material and that the Licensor has authority to license. 151 | 152 | j. Licensor means the individual(s) or entity(ies) granting rights 153 | under this Public License. 154 | 155 | k. Share means to provide material to the public by any means or 156 | process that requires permission under the Licensed Rights, such 157 | as reproduction, public display, public performance, distribution, 158 | dissemination, communication, or importation, and to make material 159 | available to the public including in ways that members of the 160 | public may access the material from a place and at a time 161 | individually chosen by them. 162 | 163 | l. Sui Generis Database Rights means rights other than copyright 164 | resulting from Directive 96/9/EC of the European Parliament and of 165 | the Council of 11 March 1996 on the legal protection of databases, 166 | as amended and/or succeeded, as well as other essentially 167 | equivalent rights anywhere in the world. 168 | 169 | m. You means the individual or entity exercising the Licensed Rights 170 | under this Public License. Your has a corresponding meaning. 171 | 172 | 173 | Section 2 -- Scope. 174 | 175 | a. License grant. 176 | 177 | 1. Subject to the terms and conditions of this Public License, 178 | the Licensor hereby grants You a worldwide, royalty-free, 179 | non-sublicensable, non-exclusive, irrevocable license to 180 | exercise the Licensed Rights in the Licensed Material to: 181 | 182 | a. reproduce and Share the Licensed Material, in whole or 183 | in part; and 184 | 185 | b. produce, reproduce, and Share Adapted Material. 186 | 187 | 2. Exceptions and Limitations. For the avoidance of doubt, where 188 | Exceptions and Limitations apply to Your use, this Public 189 | License does not apply, and You do not need to comply with 190 | its terms and conditions. 191 | 192 | 3. Term. The term of this Public License is specified in Section 193 | 6(a). 194 | 195 | 4. Media and formats; technical modifications allowed. The 196 | Licensor authorizes You to exercise the Licensed Rights in 197 | all media and formats whether now known or hereafter created, 198 | and to make technical modifications necessary to do so. The 199 | Licensor waives and/or agrees not to assert any right or 200 | authority to forbid You from making technical modifications 201 | necessary to exercise the Licensed Rights, including 202 | technical modifications necessary to circumvent Effective 203 | Technological Measures. For purposes of this Public License, 204 | simply making modifications authorized by this Section 2(a) 205 | (4) never produces Adapted Material. 206 | 207 | 5. Downstream recipients. 208 | 209 | a. Offer from the Licensor -- Licensed Material. Every 210 | recipient of the Licensed Material automatically 211 | receives an offer from the Licensor to exercise the 212 | Licensed Rights under the terms and conditions of this 213 | Public License. 214 | 215 | b. Additional offer from the Licensor -- Adapted Material. 216 | Every recipient of Adapted Material from You 217 | automatically receives an offer from the Licensor to 218 | exercise the Licensed Rights in the Adapted Material 219 | under the conditions of the Adapter's License You apply. 220 | 221 | c. No downstream restrictions. You may not offer or impose 222 | any additional or different terms or conditions on, or 223 | apply any Effective Technological Measures to, the 224 | Licensed Material if doing so restricts exercise of the 225 | Licensed Rights by any recipient of the Licensed 226 | Material. 227 | 228 | 6. No endorsement. Nothing in this Public License constitutes or 229 | may be construed as permission to assert or imply that You 230 | are, or that Your use of the Licensed Material is, connected 231 | with, or sponsored, endorsed, or granted official status by, 232 | the Licensor or others designated to receive attribution as 233 | provided in Section 3(a)(1)(A)(i). 234 | 235 | b. Other rights. 236 | 237 | 1. Moral rights, such as the right of integrity, are not 238 | licensed under this Public License, nor are publicity, 239 | privacy, and/or other similar personality rights; however, to 240 | the extent possible, the Licensor waives and/or agrees not to 241 | assert any such rights held by the Licensor to the limited 242 | extent necessary to allow You to exercise the Licensed 243 | Rights, but not otherwise. 244 | 245 | 2. Patent and trademark rights are not licensed under this 246 | Public License. 247 | 248 | 3. To the extent possible, the Licensor waives any right to 249 | collect royalties from You for the exercise of the Licensed 250 | Rights, whether directly or through a collecting society 251 | under any voluntary or waivable statutory or compulsory 252 | licensing scheme. In all other cases the Licensor expressly 253 | reserves any right to collect such royalties. 254 | 255 | 256 | Section 3 -- License Conditions. 257 | 258 | Your exercise of the Licensed Rights is expressly made subject to the 259 | following conditions. 260 | 261 | a. Attribution. 262 | 263 | 1. If You Share the Licensed Material (including in modified 264 | form), You must: 265 | 266 | a. retain the following if it is supplied by the Licensor 267 | with the Licensed Material: 268 | 269 | i. identification of the creator(s) of the Licensed 270 | Material and any others designated to receive 271 | attribution, in any reasonable manner requested by 272 | the Licensor (including by pseudonym if 273 | designated); 274 | 275 | ii. a copyright notice; 276 | 277 | iii. a notice that refers to this Public License; 278 | 279 | iv. a notice that refers to the disclaimer of 280 | warranties; 281 | 282 | v. a URI or hyperlink to the Licensed Material to the 283 | extent reasonably practicable; 284 | 285 | b. indicate if You modified the Licensed Material and 286 | retain an indication of any previous modifications; and 287 | 288 | c. indicate the Licensed Material is licensed under this 289 | Public License, and include the text of, or the URI or 290 | hyperlink to, this Public License. 291 | 292 | 2. You may satisfy the conditions in Section 3(a)(1) in any 293 | reasonable manner based on the medium, means, and context in 294 | which You Share the Licensed Material. For example, it may be 295 | reasonable to satisfy the conditions by providing a URI or 296 | hyperlink to a resource that includes the required 297 | information. 298 | 299 | 3. If requested by the Licensor, You must remove any of the 300 | information required by Section 3(a)(1)(A) to the extent 301 | reasonably practicable. 302 | 303 | b. ShareAlike. 304 | 305 | In addition to the conditions in Section 3(a), if You Share 306 | Adapted Material You produce, the following conditions also apply. 307 | 308 | 1. The Adapter's License You apply must be a Creative Commons 309 | license with the same License Elements, this version or 310 | later, or a BY-SA Compatible License. 311 | 312 | 2. You must include the text of, or the URI or hyperlink to, the 313 | Adapter's License You apply. You may satisfy this condition 314 | in any reasonable manner based on the medium, means, and 315 | context in which You Share Adapted Material. 316 | 317 | 3. You may not offer or impose any additional or different terms 318 | or conditions on, or apply any Effective Technological 319 | Measures to, Adapted Material that restrict exercise of the 320 | rights granted under the Adapter's License You apply. 321 | 322 | 323 | Section 4 -- Sui Generis Database Rights. 324 | 325 | Where the Licensed Rights include Sui Generis Database Rights that 326 | apply to Your use of the Licensed Material: 327 | 328 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 329 | to extract, reuse, reproduce, and Share all or a substantial 330 | portion of the contents of the database; 331 | 332 | b. if You include all or a substantial portion of the database 333 | contents in a database in which You have Sui Generis Database 334 | Rights, then the database in which You have Sui Generis Database 335 | Rights (but not its individual contents) is Adapted Material, 336 | 337 | including for purposes of Section 3(b); and 338 | c. You must comply with the conditions in Section 3(a) if You Share 339 | all or a substantial portion of the contents of the database. 340 | 341 | For the avoidance of doubt, this Section 4 supplements and does not 342 | replace Your obligations under this Public License where the Licensed 343 | Rights include other Copyright and Similar Rights. 344 | 345 | 346 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 347 | 348 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 349 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 350 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 351 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 352 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 353 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 354 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 355 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 356 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 357 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 358 | 359 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 360 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 361 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 362 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 363 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 364 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 365 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 366 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 367 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 368 | 369 | c. The disclaimer of warranties and limitation of liability provided 370 | above shall be interpreted in a manner that, to the extent 371 | possible, most closely approximates an absolute disclaimer and 372 | waiver of all liability. 373 | 374 | 375 | Section 6 -- Term and Termination. 376 | 377 | a. This Public License applies for the term of the Copyright and 378 | Similar Rights licensed here. However, if You fail to comply with 379 | this Public License, then Your rights under this Public License 380 | terminate automatically. 381 | 382 | b. Where Your right to use the Licensed Material has terminated under 383 | Section 6(a), it reinstates: 384 | 385 | 1. automatically as of the date the violation is cured, provided 386 | it is cured within 30 days of Your discovery of the 387 | violation; or 388 | 389 | 2. upon express reinstatement by the Licensor. 390 | 391 | For the avoidance of doubt, this Section 6(b) does not affect any 392 | right the Licensor may have to seek remedies for Your violations 393 | of this Public License. 394 | 395 | c. For the avoidance of doubt, the Licensor may also offer the 396 | Licensed Material under separate terms or conditions or stop 397 | distributing the Licensed Material at any time; however, doing so 398 | will not terminate this Public License. 399 | 400 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 401 | License. 402 | 403 | 404 | Section 7 -- Other Terms and Conditions. 405 | 406 | a. The Licensor shall not be bound by any additional or different 407 | terms or conditions communicated by You unless expressly agreed. 408 | 409 | b. Any arrangements, understandings, or agreements regarding the 410 | Licensed Material not stated herein are separate from and 411 | independent of the terms and conditions of this Public License. 412 | 413 | 414 | Section 8 -- Interpretation. 415 | 416 | a. For the avoidance of doubt, this Public License does not, and 417 | shall not be interpreted to, reduce, limit, restrict, or impose 418 | conditions on any use of the Licensed Material that could lawfully 419 | be made without permission under this Public License. 420 | 421 | b. To the extent possible, if any provision of this Public License is 422 | deemed unenforceable, it shall be automatically reformed to the 423 | minimum extent necessary to make it enforceable. If the provision 424 | cannot be reformed, it shall be severed from this Public License 425 | without affecting the enforceability of the remaining terms and 426 | conditions. 427 | 428 | c. No term or condition of this Public License will be waived and no 429 | failure to comply consented to unless expressly agreed to by the 430 | Licensor. 431 | 432 | d. Nothing in this Public License constitutes or may be interpreted 433 | as a limitation upon, or waiver of, any privileges and immunities 434 | that apply to the Licensor or You, including from the legal 435 | processes of any jurisdiction or authority. 436 | 437 | 438 | ======================================================================= 439 | 440 | Creative Commons is not a party to its public 441 | licenses. Notwithstanding, Creative Commons may elect to apply one of 442 | its public licenses to material it publishes and in those instances 443 | will be considered the “Licensor.” The text of the Creative Commons 444 | public licenses is dedicated to the public domain under the CC0 Public 445 | Domain Dedication. Except for the limited purpose of indicating that 446 | material is shared under a Creative Commons public license or as 447 | otherwise permitted by the Creative Commons policies published at 448 | creativecommons.org/policies, Creative Commons does not authorize the 449 | use of the trademark "Creative Commons" or any other trademark or logo 450 | of Creative Commons without its prior written consent including, 451 | without limitation, in connection with any unauthorized modifications 452 | to any of its public licenses or any other arrangements, 453 | understandings, or agreements concerning use of licensed material. For 454 | the avoidance of doubt, this paragraph does not form part of the 455 | public licenses. 456 | 457 | Creative Commons may be contacted at creativecommons.org. 458 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Package.swift 3 | // Roman 4 | // 5 | // The MIT License (MIT) 6 | // 7 | // Copyright (c) 2016 Nikolai Vazquez 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | import PackageDescription 29 | 30 | let package = Package( 31 | name: "Roman" 32 | ) 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Roman Banner 5 |

6 | 7 |

8 | Platform 10 | 11 | Swift Package Manager 13 | 14 | 15 | CocoaPods 17 | 18 | 19 | Carthage 21 | 22 | 23 | MIT License 25 | 26 |

27 | 28 |

29 | Installation 30 | • Usage 31 | • License 32 | • Documentation 33 |

34 | 35 | Roman is a Swift framework that allows for seamless Roman numeral conversion. 36 | 37 | ## Installation 38 | 39 | ### Compatibility: 40 | 41 | - Platforms: 42 | - OS X 43 | - iOS 44 | - watchOS 45 | - tvOS 46 | - Linux 47 | - Language: 48 | - Swift 2.1+ 49 | 50 | ### Install Using Swift Package Manager 51 | The [Swift Package Manager](https://swift.org/package-manager/) is a 52 | decentralized dependency manager for Swift. 53 | 54 | 1. Add the project to your `Package.swift`. 55 | 56 | ```swift 57 | import PackageDescription 58 | 59 | let package = Package( 60 | name: "MyAwesomeProject", 61 | dependencies: [ 62 | .Package(url: "https://github.com/nvzqz/Roman.git", 63 | majorVersion: 1) 64 | ] 65 | ) 66 | ``` 67 | 68 | 2. Import the Roman module. 69 | 70 | ```swift 71 | import Roman 72 | ``` 73 | 74 | ### Install Using CocoaPods 75 | [CocoaPods](https://cocoapods.org/) is a centralized dependency manager for 76 | Objective-C and Swift. Go [here](https://guides.cocoapods.org/using/index.html) 77 | to learn more. 78 | 79 | 1. Add the project to your [Podfile](https://guides.cocoapods.org/using/the-podfile.html). 80 | 81 | ```ruby 82 | use_frameworks! 83 | 84 | pod 'Roman', '~> 1.1.0' 85 | ``` 86 | 87 | 2. Run `pod install` and open the `.xcworkspace` file to launch Xcode. 88 | 89 | 3. Import the Roman framework. 90 | 91 | ```swift 92 | import Roman 93 | ``` 94 | 95 | ### Install Using Carthage 96 | [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency 97 | manager for Objective-C and Swift. 98 | 99 | 1. Add the project to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile). 100 | 101 | ``` 102 | github "nvzqz/Roman" 103 | ``` 104 | 105 | 2. Run `carthage update` and follow [the additional steps](https://github.com/Carthage/Carthage#getting-started) 106 | in order to add Roman to your project. 107 | 108 | 3. Import the Roman framework. 109 | 110 | ```swift 111 | import Roman 112 | ``` 113 | 114 | ### Install Manually 115 | 116 | Simply add the `Roman.swift` file into your project. 117 | 118 | ## Usage 119 | 120 | ### String 121 | 122 | A Roman numeral string can be created from an instance of a type that conforms 123 | to `IntegerType`. 124 | 125 | ```swift 126 | String(roman: 1478) // "MCDLXXVIII" 127 | String(roman: 2743) // "MMDCCXLIII" 128 | String(roman: 1226) // "MCCXXVI" 129 | String(roman: 0) // nil 130 | String(roman: -42) // nil 131 | ``` 132 | 133 | ### IntegerType 134 | 135 | All types that conform to `IntegerType` can be initialized from a Roman numeral 136 | string. 137 | 138 | The input string is case insensitive. 139 | 140 | ```swift 141 | Int(roman: "III") // 3 142 | Int(roman: "MIV") // 1004 143 | Int(roman: "CdV") // 405 144 | ``` 145 | 146 | Roman even supports irregular numerals that don't use a short form. 147 | 148 | Each of the following evaluates to `true`: 149 | 150 | ```swift 151 | Int(roman: "IV") == Int(roman: "IIII") 152 | Int(roman: "XX") == Int(roman: "VVVV") 153 | Int(roman: "CD") == Int(roman: "CCCC") 154 | ``` 155 | 156 | Invalid strings return `nil`. 157 | 158 | ```swift 159 | Int(roman: "hello") == nil 160 | Int(roman: "IIIXX") == nil 161 | Int(roman: "XYZ") == nil 162 | ``` 163 | 164 | ### FloatingPointType 165 | 166 | All types that conform to `FloatingPointType` can be initialized from a Roman 167 | numeral string. 168 | 169 | Creating instances from Roman numerals works the same way as with `IntegerType`. 170 | 171 | ## License 172 | 173 | Roman is released under the [MIT License](https://opensource.org/licenses/MIT). 174 | 175 | All assets are released under the Creative Commons [Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/) 176 | and can be found in the [Assets](https://github.com/nvzqz/Roman/tree/master/Assets) 177 | folder. 178 | -------------------------------------------------------------------------------- /Roman.playground/Contents.swift: -------------------------------------------------------------------------------- 1 | /*: 2 | # Roman 3 | Use this playground to try out Roman 4 | */ 5 | import Roman 6 | -------------------------------------------------------------------------------- /Roman.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Roman.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Roman.playground/timeline.xctimeline: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Roman.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "Roman" 3 | s.version = "1.1.0" 4 | s.summary = "Seamless Roman numeral conversion in Swift." 5 | s.homepage = "https://github.com/nvzqz/Roman" 6 | s.license = { :type => "MIT", :file => "LICENSE.txt" } 7 | s.author = "Nikolai Vazquez" 8 | s.ios.deployment_target = "8.0" 9 | s.osx.deployment_target = "10.9" 10 | s.watchos.deployment_target = '2.0' 11 | s.tvos.deployment_target = '9.0' 12 | s.source = { :git => "https://github.com/nvzqz/Roman.git", :tag => "v#{s.version}" } 13 | s.source_files = "Sources/*.swift" 14 | end 15 | -------------------------------------------------------------------------------- /Roman.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 524FEC7C1C4E10330090ADBE /* Roman.swift in Sources */ = {isa = PBXBuildFile; fileRef = 524FEC7B1C4E10330090ADBE /* Roman.swift */; }; 11 | 524FEC7D1C4E10330090ADBE /* Roman.swift in Sources */ = {isa = PBXBuildFile; fileRef = 524FEC7B1C4E10330090ADBE /* Roman.swift */; }; 12 | 524FEC7E1C4E10330090ADBE /* Roman.swift in Sources */ = {isa = PBXBuildFile; fileRef = 524FEC7B1C4E10330090ADBE /* Roman.swift */; }; 13 | 524FEC7F1C4E10330090ADBE /* Roman.swift in Sources */ = {isa = PBXBuildFile; fileRef = 524FEC7B1C4E10330090ADBE /* Roman.swift */; }; 14 | 524FEC8E1C4F45EE0090ADBE /* Roman.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 524FEC4A1C4E0FE70090ADBE /* Roman.framework */; }; 15 | 524FEC9D1C4F465B0090ADBE /* RomanTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 524FEC9C1C4F465B0090ADBE /* RomanTests.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXContainerItemProxy section */ 19 | 524FEC8F1C4F45EE0090ADBE /* PBXContainerItemProxy */ = { 20 | isa = PBXContainerItemProxy; 21 | containerPortal = 524FEC3F1C4E0FD80090ADBE /* Project object */; 22 | proxyType = 1; 23 | remoteGlobalIDString = 524FEC491C4E0FE70090ADBE; 24 | remoteInfo = "Roman OSX"; 25 | }; 26 | /* End PBXContainerItemProxy section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 524FEC4A1C4E0FE70090ADBE /* Roman.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Roman.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 524FEC581C4E0FF10090ADBE /* Roman.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Roman.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 524FEC651C4E10030090ADBE /* Roman.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Roman.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 524FEC721C4E100A0090ADBE /* Roman.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Roman.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 524FEC7B1C4E10330090ADBE /* Roman.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Roman.swift; sourceTree = ""; }; 34 | 524FEC811C4E103D0090ADBE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 524FEC821C4E11740090ADBE /* Roman.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = Roman.playground; sourceTree = ""; }; 36 | 524FEC831C4E117F0090ADBE /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 37 | 524FEC841C4E11910090ADBE /* LICENSE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE.txt; sourceTree = ""; }; 38 | 524FEC891C4F45EE0090ADBE /* Roman Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Roman Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 524FEC951C4F460A0090ADBE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 524FEC9C1C4F465B0090ADBE /* RomanTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RomanTests.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 524FEC461C4E0FE70090ADBE /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 524FEC541C4E0FF10090ADBE /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | 524FEC611C4E10030090ADBE /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | 524FEC6E1C4E100A0090ADBE /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | 524FEC861C4F45EE0090ADBE /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | 524FEC8E1C4F45EE0090ADBE /* Roman.framework in Frameworks */, 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 524FEC3E1C4E0FD80090ADBE = { 84 | isa = PBXGroup; 85 | children = ( 86 | 524FEC7A1C4E10330090ADBE /* Sources */, 87 | 524FEC801C4E103D0090ADBE /* Support */, 88 | 524FEC941C4F460A0090ADBE /* Tests */, 89 | 524FEC4B1C4E0FE70090ADBE /* Products */, 90 | 524FEC821C4E11740090ADBE /* Roman.playground */, 91 | 524FEC831C4E117F0090ADBE /* Package.swift */, 92 | 524FEC841C4E11910090ADBE /* LICENSE.txt */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 524FEC4B1C4E0FE70090ADBE /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 524FEC4A1C4E0FE70090ADBE /* Roman.framework */, 100 | 524FEC581C4E0FF10090ADBE /* Roman.framework */, 101 | 524FEC651C4E10030090ADBE /* Roman.framework */, 102 | 524FEC721C4E100A0090ADBE /* Roman.framework */, 103 | 524FEC891C4F45EE0090ADBE /* Roman Tests.xctest */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | 524FEC7A1C4E10330090ADBE /* Sources */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 524FEC7B1C4E10330090ADBE /* Roman.swift */, 112 | ); 113 | path = Sources; 114 | sourceTree = ""; 115 | }; 116 | 524FEC801C4E103D0090ADBE /* Support */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 524FEC811C4E103D0090ADBE /* Info.plist */, 120 | ); 121 | path = Support; 122 | sourceTree = ""; 123 | }; 124 | 524FEC941C4F460A0090ADBE /* Tests */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 524FEC9C1C4F465B0090ADBE /* RomanTests.swift */, 128 | 524FEC951C4F460A0090ADBE /* Info.plist */, 129 | ); 130 | path = Tests; 131 | sourceTree = ""; 132 | }; 133 | /* End PBXGroup section */ 134 | 135 | /* Begin PBXHeadersBuildPhase section */ 136 | 524FEC471C4E0FE70090ADBE /* Headers */ = { 137 | isa = PBXHeadersBuildPhase; 138 | buildActionMask = 2147483647; 139 | files = ( 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | 524FEC551C4E0FF10090ADBE /* Headers */ = { 144 | isa = PBXHeadersBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | 524FEC621C4E10030090ADBE /* Headers */ = { 151 | isa = PBXHeadersBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | 524FEC6F1C4E100A0090ADBE /* Headers */ = { 158 | isa = PBXHeadersBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | ); 162 | runOnlyForDeploymentPostprocessing = 0; 163 | }; 164 | /* End PBXHeadersBuildPhase section */ 165 | 166 | /* Begin PBXNativeTarget section */ 167 | 524FEC491C4E0FE70090ADBE /* Roman OSX */ = { 168 | isa = PBXNativeTarget; 169 | buildConfigurationList = 524FEC521C4E0FE80090ADBE /* Build configuration list for PBXNativeTarget "Roman OSX" */; 170 | buildPhases = ( 171 | 524FEC451C4E0FE70090ADBE /* Sources */, 172 | 524FEC461C4E0FE70090ADBE /* Frameworks */, 173 | 524FEC471C4E0FE70090ADBE /* Headers */, 174 | 524FEC481C4E0FE70090ADBE /* Resources */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | ); 180 | name = "Roman OSX"; 181 | productName = "Roman OSX"; 182 | productReference = 524FEC4A1C4E0FE70090ADBE /* Roman.framework */; 183 | productType = "com.apple.product-type.framework"; 184 | }; 185 | 524FEC571C4E0FF10090ADBE /* Roman iOS */ = { 186 | isa = PBXNativeTarget; 187 | buildConfigurationList = 524FEC5D1C4E0FF10090ADBE /* Build configuration list for PBXNativeTarget "Roman iOS" */; 188 | buildPhases = ( 189 | 524FEC531C4E0FF10090ADBE /* Sources */, 190 | 524FEC541C4E0FF10090ADBE /* Frameworks */, 191 | 524FEC551C4E0FF10090ADBE /* Headers */, 192 | 524FEC561C4E0FF10090ADBE /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | ); 198 | name = "Roman iOS"; 199 | productName = "Roman iOS"; 200 | productReference = 524FEC581C4E0FF10090ADBE /* Roman.framework */; 201 | productType = "com.apple.product-type.framework"; 202 | }; 203 | 524FEC641C4E10030090ADBE /* Roman watchOS */ = { 204 | isa = PBXNativeTarget; 205 | buildConfigurationList = 524FEC6A1C4E10030090ADBE /* Build configuration list for PBXNativeTarget "Roman watchOS" */; 206 | buildPhases = ( 207 | 524FEC601C4E10030090ADBE /* Sources */, 208 | 524FEC611C4E10030090ADBE /* Frameworks */, 209 | 524FEC621C4E10030090ADBE /* Headers */, 210 | 524FEC631C4E10030090ADBE /* Resources */, 211 | ); 212 | buildRules = ( 213 | ); 214 | dependencies = ( 215 | ); 216 | name = "Roman watchOS"; 217 | productName = "Roman watchOS"; 218 | productReference = 524FEC651C4E10030090ADBE /* Roman.framework */; 219 | productType = "com.apple.product-type.framework"; 220 | }; 221 | 524FEC711C4E100A0090ADBE /* Roman tvOS */ = { 222 | isa = PBXNativeTarget; 223 | buildConfigurationList = 524FEC771C4E100A0090ADBE /* Build configuration list for PBXNativeTarget "Roman tvOS" */; 224 | buildPhases = ( 225 | 524FEC6D1C4E100A0090ADBE /* Sources */, 226 | 524FEC6E1C4E100A0090ADBE /* Frameworks */, 227 | 524FEC6F1C4E100A0090ADBE /* Headers */, 228 | 524FEC701C4E100A0090ADBE /* Resources */, 229 | ); 230 | buildRules = ( 231 | ); 232 | dependencies = ( 233 | ); 234 | name = "Roman tvOS"; 235 | productName = "Roman tvOS"; 236 | productReference = 524FEC721C4E100A0090ADBE /* Roman.framework */; 237 | productType = "com.apple.product-type.framework"; 238 | }; 239 | 524FEC881C4F45EE0090ADBE /* Roman Tests */ = { 240 | isa = PBXNativeTarget; 241 | buildConfigurationList = 524FEC911C4F45EE0090ADBE /* Build configuration list for PBXNativeTarget "Roman Tests" */; 242 | buildPhases = ( 243 | 524FEC851C4F45EE0090ADBE /* Sources */, 244 | 524FEC861C4F45EE0090ADBE /* Frameworks */, 245 | 524FEC871C4F45EE0090ADBE /* Resources */, 246 | ); 247 | buildRules = ( 248 | ); 249 | dependencies = ( 250 | 524FEC901C4F45EE0090ADBE /* PBXTargetDependency */, 251 | ); 252 | name = "Roman Tests"; 253 | productName = "Roman Tests"; 254 | productReference = 524FEC891C4F45EE0090ADBE /* Roman Tests.xctest */; 255 | productType = "com.apple.product-type.bundle.unit-test"; 256 | }; 257 | /* End PBXNativeTarget section */ 258 | 259 | /* Begin PBXProject section */ 260 | 524FEC3F1C4E0FD80090ADBE /* Project object */ = { 261 | isa = PBXProject; 262 | attributes = { 263 | LastSwiftUpdateCheck = 0720; 264 | LastUpgradeCheck = 0720; 265 | TargetAttributes = { 266 | 524FEC491C4E0FE70090ADBE = { 267 | CreatedOnToolsVersion = 7.2; 268 | }; 269 | 524FEC571C4E0FF10090ADBE = { 270 | CreatedOnToolsVersion = 7.2; 271 | }; 272 | 524FEC641C4E10030090ADBE = { 273 | CreatedOnToolsVersion = 7.2; 274 | }; 275 | 524FEC711C4E100A0090ADBE = { 276 | CreatedOnToolsVersion = 7.2; 277 | }; 278 | 524FEC881C4F45EE0090ADBE = { 279 | CreatedOnToolsVersion = 7.2; 280 | }; 281 | }; 282 | }; 283 | buildConfigurationList = 524FEC421C4E0FD80090ADBE /* Build configuration list for PBXProject "Roman" */; 284 | compatibilityVersion = "Xcode 3.2"; 285 | developmentRegion = English; 286 | hasScannedForEncodings = 0; 287 | knownRegions = ( 288 | en, 289 | ); 290 | mainGroup = 524FEC3E1C4E0FD80090ADBE; 291 | productRefGroup = 524FEC4B1C4E0FE70090ADBE /* Products */; 292 | projectDirPath = ""; 293 | projectRoot = ""; 294 | targets = ( 295 | 524FEC491C4E0FE70090ADBE /* Roman OSX */, 296 | 524FEC571C4E0FF10090ADBE /* Roman iOS */, 297 | 524FEC641C4E10030090ADBE /* Roman watchOS */, 298 | 524FEC711C4E100A0090ADBE /* Roman tvOS */, 299 | 524FEC881C4F45EE0090ADBE /* Roman Tests */, 300 | ); 301 | }; 302 | /* End PBXProject section */ 303 | 304 | /* Begin PBXResourcesBuildPhase section */ 305 | 524FEC481C4E0FE70090ADBE /* Resources */ = { 306 | isa = PBXResourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | ); 310 | runOnlyForDeploymentPostprocessing = 0; 311 | }; 312 | 524FEC561C4E0FF10090ADBE /* Resources */ = { 313 | isa = PBXResourcesBuildPhase; 314 | buildActionMask = 2147483647; 315 | files = ( 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | 524FEC631C4E10030090ADBE /* Resources */ = { 320 | isa = PBXResourcesBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | ); 324 | runOnlyForDeploymentPostprocessing = 0; 325 | }; 326 | 524FEC701C4E100A0090ADBE /* Resources */ = { 327 | isa = PBXResourcesBuildPhase; 328 | buildActionMask = 2147483647; 329 | files = ( 330 | ); 331 | runOnlyForDeploymentPostprocessing = 0; 332 | }; 333 | 524FEC871C4F45EE0090ADBE /* Resources */ = { 334 | isa = PBXResourcesBuildPhase; 335 | buildActionMask = 2147483647; 336 | files = ( 337 | ); 338 | runOnlyForDeploymentPostprocessing = 0; 339 | }; 340 | /* End PBXResourcesBuildPhase section */ 341 | 342 | /* Begin PBXSourcesBuildPhase section */ 343 | 524FEC451C4E0FE70090ADBE /* Sources */ = { 344 | isa = PBXSourcesBuildPhase; 345 | buildActionMask = 2147483647; 346 | files = ( 347 | 524FEC7C1C4E10330090ADBE /* Roman.swift in Sources */, 348 | ); 349 | runOnlyForDeploymentPostprocessing = 0; 350 | }; 351 | 524FEC531C4E0FF10090ADBE /* Sources */ = { 352 | isa = PBXSourcesBuildPhase; 353 | buildActionMask = 2147483647; 354 | files = ( 355 | 524FEC7D1C4E10330090ADBE /* Roman.swift in Sources */, 356 | ); 357 | runOnlyForDeploymentPostprocessing = 0; 358 | }; 359 | 524FEC601C4E10030090ADBE /* Sources */ = { 360 | isa = PBXSourcesBuildPhase; 361 | buildActionMask = 2147483647; 362 | files = ( 363 | 524FEC7E1C4E10330090ADBE /* Roman.swift in Sources */, 364 | ); 365 | runOnlyForDeploymentPostprocessing = 0; 366 | }; 367 | 524FEC6D1C4E100A0090ADBE /* Sources */ = { 368 | isa = PBXSourcesBuildPhase; 369 | buildActionMask = 2147483647; 370 | files = ( 371 | 524FEC7F1C4E10330090ADBE /* Roman.swift in Sources */, 372 | ); 373 | runOnlyForDeploymentPostprocessing = 0; 374 | }; 375 | 524FEC851C4F45EE0090ADBE /* Sources */ = { 376 | isa = PBXSourcesBuildPhase; 377 | buildActionMask = 2147483647; 378 | files = ( 379 | 524FEC9D1C4F465B0090ADBE /* RomanTests.swift in Sources */, 380 | ); 381 | runOnlyForDeploymentPostprocessing = 0; 382 | }; 383 | /* End PBXSourcesBuildPhase section */ 384 | 385 | /* Begin PBXTargetDependency section */ 386 | 524FEC901C4F45EE0090ADBE /* PBXTargetDependency */ = { 387 | isa = PBXTargetDependency; 388 | target = 524FEC491C4E0FE70090ADBE /* Roman OSX */; 389 | targetProxy = 524FEC8F1C4F45EE0090ADBE /* PBXContainerItemProxy */; 390 | }; 391 | /* End PBXTargetDependency section */ 392 | 393 | /* Begin XCBuildConfiguration section */ 394 | 524FEC431C4E0FD80090ADBE /* Debug */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | PROJECT_BUNDLE_IDENTIFIER = "com.nikolaivazquez.$(PROJECT_NAME)"; 398 | }; 399 | name = Debug; 400 | }; 401 | 524FEC441C4E0FD80090ADBE /* Release */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | PROJECT_BUNDLE_IDENTIFIER = "com.nikolaivazquez.$(PROJECT_NAME)"; 405 | }; 406 | name = Release; 407 | }; 408 | 524FEC501C4E0FE80090ADBE /* Debug */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | ALWAYS_SEARCH_USER_PATHS = NO; 412 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 413 | CLANG_CXX_LIBRARY = "libc++"; 414 | CLANG_ENABLE_MODULES = YES; 415 | CLANG_ENABLE_OBJC_ARC = YES; 416 | CLANG_WARN_BOOL_CONVERSION = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 419 | CLANG_WARN_EMPTY_BODY = YES; 420 | CLANG_WARN_ENUM_CONVERSION = YES; 421 | CLANG_WARN_INT_CONVERSION = YES; 422 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 423 | CLANG_WARN_UNREACHABLE_CODE = YES; 424 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 425 | CODE_SIGN_IDENTITY = "-"; 426 | COMBINE_HIDPI_IMAGES = YES; 427 | COPY_PHASE_STRIP = NO; 428 | CURRENT_PROJECT_VERSION = 1; 429 | DEBUG_INFORMATION_FORMAT = dwarf; 430 | DEFINES_MODULE = YES; 431 | DYLIB_COMPATIBILITY_VERSION = 1; 432 | DYLIB_CURRENT_VERSION = 1; 433 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 434 | ENABLE_STRICT_OBJC_MSGSEND = YES; 435 | ENABLE_TESTABILITY = YES; 436 | FRAMEWORK_VERSION = A; 437 | GCC_C_LANGUAGE_STANDARD = gnu99; 438 | GCC_DYNAMIC_NO_PIC = NO; 439 | GCC_NO_COMMON_BLOCKS = YES; 440 | GCC_OPTIMIZATION_LEVEL = 0; 441 | GCC_PREPROCESSOR_DEFINITIONS = ( 442 | "DEBUG=1", 443 | "$(inherited)", 444 | ); 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 447 | GCC_WARN_UNDECLARED_SELECTOR = YES; 448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 449 | GCC_WARN_UNUSED_FUNCTION = YES; 450 | GCC_WARN_UNUSED_VARIABLE = YES; 451 | INFOPLIST_FILE = "$(SRCROOT)/Support/Info.plist"; 452 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 453 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 454 | MACOSX_DEPLOYMENT_TARGET = 10.9; 455 | MTL_ENABLE_DEBUG_INFO = YES; 456 | ONLY_ACTIVE_ARCH = YES; 457 | PRODUCT_BUNDLE_IDENTIFIER = "$(PROJECT_BUNDLE_IDENTIFIER)"; 458 | PRODUCT_NAME = "$(PROJECT_NAME)"; 459 | SDKROOT = macosx; 460 | SKIP_INSTALL = YES; 461 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | VERSION_INFO_PREFIX = ""; 464 | }; 465 | name = Debug; 466 | }; 467 | 524FEC511C4E0FE80090ADBE /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | ALWAYS_SEARCH_USER_PATHS = NO; 471 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 472 | CLANG_CXX_LIBRARY = "libc++"; 473 | CLANG_ENABLE_MODULES = YES; 474 | CLANG_ENABLE_OBJC_ARC = YES; 475 | CLANG_WARN_BOOL_CONVERSION = YES; 476 | CLANG_WARN_CONSTANT_CONVERSION = YES; 477 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 478 | CLANG_WARN_EMPTY_BODY = YES; 479 | CLANG_WARN_ENUM_CONVERSION = YES; 480 | CLANG_WARN_INT_CONVERSION = YES; 481 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 482 | CLANG_WARN_UNREACHABLE_CODE = YES; 483 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 484 | CODE_SIGN_IDENTITY = "-"; 485 | COMBINE_HIDPI_IMAGES = YES; 486 | COPY_PHASE_STRIP = NO; 487 | CURRENT_PROJECT_VERSION = 1; 488 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 489 | DEFINES_MODULE = YES; 490 | DYLIB_COMPATIBILITY_VERSION = 1; 491 | DYLIB_CURRENT_VERSION = 1; 492 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 493 | ENABLE_NS_ASSERTIONS = NO; 494 | ENABLE_STRICT_OBJC_MSGSEND = YES; 495 | FRAMEWORK_VERSION = A; 496 | GCC_C_LANGUAGE_STANDARD = gnu99; 497 | GCC_NO_COMMON_BLOCKS = YES; 498 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 499 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 500 | GCC_WARN_UNDECLARED_SELECTOR = YES; 501 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 502 | GCC_WARN_UNUSED_FUNCTION = YES; 503 | GCC_WARN_UNUSED_VARIABLE = YES; 504 | INFOPLIST_FILE = "$(SRCROOT)/Support/Info.plist"; 505 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 507 | MACOSX_DEPLOYMENT_TARGET = 10.9; 508 | MTL_ENABLE_DEBUG_INFO = NO; 509 | PRODUCT_BUNDLE_IDENTIFIER = "$(PROJECT_BUNDLE_IDENTIFIER)"; 510 | PRODUCT_NAME = "$(PROJECT_NAME)"; 511 | SDKROOT = macosx; 512 | SKIP_INSTALL = YES; 513 | VERSIONING_SYSTEM = "apple-generic"; 514 | VERSION_INFO_PREFIX = ""; 515 | }; 516 | name = Release; 517 | }; 518 | 524FEC5E1C4E0FF10090ADBE /* Debug */ = { 519 | isa = XCBuildConfiguration; 520 | buildSettings = { 521 | ALWAYS_SEARCH_USER_PATHS = NO; 522 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 523 | CLANG_CXX_LIBRARY = "libc++"; 524 | CLANG_ENABLE_MODULES = YES; 525 | CLANG_ENABLE_OBJC_ARC = YES; 526 | CLANG_WARN_BOOL_CONVERSION = YES; 527 | CLANG_WARN_CONSTANT_CONVERSION = YES; 528 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 529 | CLANG_WARN_EMPTY_BODY = YES; 530 | CLANG_WARN_ENUM_CONVERSION = YES; 531 | CLANG_WARN_INT_CONVERSION = YES; 532 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 533 | CLANG_WARN_UNREACHABLE_CODE = YES; 534 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 535 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 536 | COPY_PHASE_STRIP = NO; 537 | CURRENT_PROJECT_VERSION = 1; 538 | DEBUG_INFORMATION_FORMAT = dwarf; 539 | DEFINES_MODULE = YES; 540 | DYLIB_COMPATIBILITY_VERSION = 1; 541 | DYLIB_CURRENT_VERSION = 1; 542 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 543 | ENABLE_STRICT_OBJC_MSGSEND = YES; 544 | ENABLE_TESTABILITY = YES; 545 | GCC_C_LANGUAGE_STANDARD = gnu99; 546 | GCC_DYNAMIC_NO_PIC = NO; 547 | GCC_NO_COMMON_BLOCKS = YES; 548 | GCC_OPTIMIZATION_LEVEL = 0; 549 | GCC_PREPROCESSOR_DEFINITIONS = ( 550 | "DEBUG=1", 551 | "$(inherited)", 552 | ); 553 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 554 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 555 | GCC_WARN_UNDECLARED_SELECTOR = YES; 556 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 557 | GCC_WARN_UNUSED_FUNCTION = YES; 558 | GCC_WARN_UNUSED_VARIABLE = YES; 559 | INFOPLIST_FILE = "$(SRCROOT)/Support/Info.plist"; 560 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 561 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 562 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 563 | MTL_ENABLE_DEBUG_INFO = YES; 564 | ONLY_ACTIVE_ARCH = YES; 565 | PRODUCT_BUNDLE_IDENTIFIER = "$(PROJECT_BUNDLE_IDENTIFIER)"; 566 | PRODUCT_NAME = "$(PROJECT_NAME)"; 567 | SDKROOT = iphoneos; 568 | SKIP_INSTALL = YES; 569 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 570 | TARGETED_DEVICE_FAMILY = "1,2"; 571 | VERSIONING_SYSTEM = "apple-generic"; 572 | VERSION_INFO_PREFIX = ""; 573 | }; 574 | name = Debug; 575 | }; 576 | 524FEC5F1C4E0FF10090ADBE /* Release */ = { 577 | isa = XCBuildConfiguration; 578 | buildSettings = { 579 | ALWAYS_SEARCH_USER_PATHS = NO; 580 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 581 | CLANG_CXX_LIBRARY = "libc++"; 582 | CLANG_ENABLE_MODULES = YES; 583 | CLANG_ENABLE_OBJC_ARC = YES; 584 | CLANG_WARN_BOOL_CONVERSION = YES; 585 | CLANG_WARN_CONSTANT_CONVERSION = YES; 586 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 587 | CLANG_WARN_EMPTY_BODY = YES; 588 | CLANG_WARN_ENUM_CONVERSION = YES; 589 | CLANG_WARN_INT_CONVERSION = YES; 590 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 591 | CLANG_WARN_UNREACHABLE_CODE = YES; 592 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 593 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 594 | COPY_PHASE_STRIP = NO; 595 | CURRENT_PROJECT_VERSION = 1; 596 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 597 | DEFINES_MODULE = YES; 598 | DYLIB_COMPATIBILITY_VERSION = 1; 599 | DYLIB_CURRENT_VERSION = 1; 600 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 601 | ENABLE_NS_ASSERTIONS = NO; 602 | ENABLE_STRICT_OBJC_MSGSEND = YES; 603 | GCC_C_LANGUAGE_STANDARD = gnu99; 604 | GCC_NO_COMMON_BLOCKS = YES; 605 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 606 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 607 | GCC_WARN_UNDECLARED_SELECTOR = YES; 608 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 609 | GCC_WARN_UNUSED_FUNCTION = YES; 610 | GCC_WARN_UNUSED_VARIABLE = YES; 611 | INFOPLIST_FILE = "$(SRCROOT)/Support/Info.plist"; 612 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 613 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 614 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 615 | MTL_ENABLE_DEBUG_INFO = NO; 616 | PRODUCT_BUNDLE_IDENTIFIER = "$(PROJECT_BUNDLE_IDENTIFIER)"; 617 | PRODUCT_NAME = "$(PROJECT_NAME)"; 618 | SDKROOT = iphoneos; 619 | SKIP_INSTALL = YES; 620 | TARGETED_DEVICE_FAMILY = "1,2"; 621 | VALIDATE_PRODUCT = YES; 622 | VERSIONING_SYSTEM = "apple-generic"; 623 | VERSION_INFO_PREFIX = ""; 624 | }; 625 | name = Release; 626 | }; 627 | 524FEC6B1C4E10030090ADBE /* Debug */ = { 628 | isa = XCBuildConfiguration; 629 | buildSettings = { 630 | ALWAYS_SEARCH_USER_PATHS = NO; 631 | APPLICATION_EXTENSION_API_ONLY = YES; 632 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 633 | CLANG_CXX_LIBRARY = "libc++"; 634 | CLANG_ENABLE_MODULES = YES; 635 | CLANG_ENABLE_OBJC_ARC = YES; 636 | CLANG_WARN_BOOL_CONVERSION = YES; 637 | CLANG_WARN_CONSTANT_CONVERSION = YES; 638 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 639 | CLANG_WARN_EMPTY_BODY = YES; 640 | CLANG_WARN_ENUM_CONVERSION = YES; 641 | CLANG_WARN_INT_CONVERSION = YES; 642 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 643 | CLANG_WARN_UNREACHABLE_CODE = YES; 644 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 645 | COPY_PHASE_STRIP = NO; 646 | CURRENT_PROJECT_VERSION = 1; 647 | DEBUG_INFORMATION_FORMAT = dwarf; 648 | DEFINES_MODULE = YES; 649 | DYLIB_COMPATIBILITY_VERSION = 1; 650 | DYLIB_CURRENT_VERSION = 1; 651 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 652 | ENABLE_STRICT_OBJC_MSGSEND = YES; 653 | ENABLE_TESTABILITY = YES; 654 | GCC_C_LANGUAGE_STANDARD = gnu99; 655 | GCC_DYNAMIC_NO_PIC = NO; 656 | GCC_NO_COMMON_BLOCKS = YES; 657 | GCC_OPTIMIZATION_LEVEL = 0; 658 | GCC_PREPROCESSOR_DEFINITIONS = ( 659 | "DEBUG=1", 660 | "$(inherited)", 661 | ); 662 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 663 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 664 | GCC_WARN_UNDECLARED_SELECTOR = YES; 665 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 666 | GCC_WARN_UNUSED_FUNCTION = YES; 667 | GCC_WARN_UNUSED_VARIABLE = YES; 668 | INFOPLIST_FILE = "$(SRCROOT)/Support/Info.plist"; 669 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 670 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 671 | MTL_ENABLE_DEBUG_INFO = YES; 672 | ONLY_ACTIVE_ARCH = YES; 673 | PRODUCT_BUNDLE_IDENTIFIER = "$(PROJECT_BUNDLE_IDENTIFIER)"; 674 | PRODUCT_NAME = "$(PROJECT_NAME)"; 675 | SDKROOT = watchos; 676 | SKIP_INSTALL = YES; 677 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 678 | TARGETED_DEVICE_FAMILY = 4; 679 | VERSIONING_SYSTEM = "apple-generic"; 680 | VERSION_INFO_PREFIX = ""; 681 | WATCHOS_DEPLOYMENT_TARGET = 2.1; 682 | }; 683 | name = Debug; 684 | }; 685 | 524FEC6C1C4E10030090ADBE /* Release */ = { 686 | isa = XCBuildConfiguration; 687 | buildSettings = { 688 | ALWAYS_SEARCH_USER_PATHS = NO; 689 | APPLICATION_EXTENSION_API_ONLY = YES; 690 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 691 | CLANG_CXX_LIBRARY = "libc++"; 692 | CLANG_ENABLE_MODULES = YES; 693 | CLANG_ENABLE_OBJC_ARC = YES; 694 | CLANG_WARN_BOOL_CONVERSION = YES; 695 | CLANG_WARN_CONSTANT_CONVERSION = YES; 696 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 697 | CLANG_WARN_EMPTY_BODY = YES; 698 | CLANG_WARN_ENUM_CONVERSION = YES; 699 | CLANG_WARN_INT_CONVERSION = YES; 700 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 701 | CLANG_WARN_UNREACHABLE_CODE = YES; 702 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 703 | COPY_PHASE_STRIP = NO; 704 | CURRENT_PROJECT_VERSION = 1; 705 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 706 | DEFINES_MODULE = YES; 707 | DYLIB_COMPATIBILITY_VERSION = 1; 708 | DYLIB_CURRENT_VERSION = 1; 709 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 710 | ENABLE_NS_ASSERTIONS = NO; 711 | ENABLE_STRICT_OBJC_MSGSEND = YES; 712 | GCC_C_LANGUAGE_STANDARD = gnu99; 713 | GCC_NO_COMMON_BLOCKS = YES; 714 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 715 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 716 | GCC_WARN_UNDECLARED_SELECTOR = YES; 717 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 718 | GCC_WARN_UNUSED_FUNCTION = YES; 719 | GCC_WARN_UNUSED_VARIABLE = YES; 720 | INFOPLIST_FILE = "$(SRCROOT)/Support/Info.plist"; 721 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 722 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 723 | MTL_ENABLE_DEBUG_INFO = NO; 724 | PRODUCT_BUNDLE_IDENTIFIER = "$(PROJECT_BUNDLE_IDENTIFIER)"; 725 | PRODUCT_NAME = "$(PROJECT_NAME)"; 726 | SDKROOT = watchos; 727 | SKIP_INSTALL = YES; 728 | TARGETED_DEVICE_FAMILY = 4; 729 | VALIDATE_PRODUCT = YES; 730 | VERSIONING_SYSTEM = "apple-generic"; 731 | VERSION_INFO_PREFIX = ""; 732 | WATCHOS_DEPLOYMENT_TARGET = 2.1; 733 | }; 734 | name = Release; 735 | }; 736 | 524FEC781C4E100A0090ADBE /* Debug */ = { 737 | isa = XCBuildConfiguration; 738 | buildSettings = { 739 | ALWAYS_SEARCH_USER_PATHS = NO; 740 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 741 | CLANG_CXX_LIBRARY = "libc++"; 742 | CLANG_ENABLE_MODULES = YES; 743 | CLANG_ENABLE_OBJC_ARC = YES; 744 | CLANG_WARN_BOOL_CONVERSION = YES; 745 | CLANG_WARN_CONSTANT_CONVERSION = YES; 746 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 747 | CLANG_WARN_EMPTY_BODY = YES; 748 | CLANG_WARN_ENUM_CONVERSION = YES; 749 | CLANG_WARN_INT_CONVERSION = YES; 750 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 751 | CLANG_WARN_UNREACHABLE_CODE = YES; 752 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 753 | COPY_PHASE_STRIP = NO; 754 | CURRENT_PROJECT_VERSION = 1; 755 | DEBUG_INFORMATION_FORMAT = dwarf; 756 | DEFINES_MODULE = YES; 757 | DYLIB_COMPATIBILITY_VERSION = 1; 758 | DYLIB_CURRENT_VERSION = 1; 759 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 760 | ENABLE_STRICT_OBJC_MSGSEND = YES; 761 | ENABLE_TESTABILITY = YES; 762 | GCC_C_LANGUAGE_STANDARD = gnu99; 763 | GCC_DYNAMIC_NO_PIC = NO; 764 | GCC_NO_COMMON_BLOCKS = YES; 765 | GCC_OPTIMIZATION_LEVEL = 0; 766 | GCC_PREPROCESSOR_DEFINITIONS = ( 767 | "DEBUG=1", 768 | "$(inherited)", 769 | ); 770 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 771 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 772 | GCC_WARN_UNDECLARED_SELECTOR = YES; 773 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 774 | GCC_WARN_UNUSED_FUNCTION = YES; 775 | GCC_WARN_UNUSED_VARIABLE = YES; 776 | INFOPLIST_FILE = "$(SRCROOT)/Support/Info.plist"; 777 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 778 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 779 | MTL_ENABLE_DEBUG_INFO = YES; 780 | ONLY_ACTIVE_ARCH = YES; 781 | PRODUCT_BUNDLE_IDENTIFIER = "$(PROJECT_BUNDLE_IDENTIFIER)"; 782 | PRODUCT_NAME = "$(PROJECT_NAME)"; 783 | SDKROOT = appletvos; 784 | SKIP_INSTALL = YES; 785 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 786 | TARGETED_DEVICE_FAMILY = 3; 787 | TVOS_DEPLOYMENT_TARGET = 9.0; 788 | VERSIONING_SYSTEM = "apple-generic"; 789 | VERSION_INFO_PREFIX = ""; 790 | }; 791 | name = Debug; 792 | }; 793 | 524FEC791C4E100A0090ADBE /* Release */ = { 794 | isa = XCBuildConfiguration; 795 | buildSettings = { 796 | ALWAYS_SEARCH_USER_PATHS = NO; 797 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 798 | CLANG_CXX_LIBRARY = "libc++"; 799 | CLANG_ENABLE_MODULES = YES; 800 | CLANG_ENABLE_OBJC_ARC = YES; 801 | CLANG_WARN_BOOL_CONVERSION = YES; 802 | CLANG_WARN_CONSTANT_CONVERSION = YES; 803 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 804 | CLANG_WARN_EMPTY_BODY = YES; 805 | CLANG_WARN_ENUM_CONVERSION = YES; 806 | CLANG_WARN_INT_CONVERSION = YES; 807 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 808 | CLANG_WARN_UNREACHABLE_CODE = YES; 809 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 810 | COPY_PHASE_STRIP = NO; 811 | CURRENT_PROJECT_VERSION = 1; 812 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 813 | DEFINES_MODULE = YES; 814 | DYLIB_COMPATIBILITY_VERSION = 1; 815 | DYLIB_CURRENT_VERSION = 1; 816 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 817 | ENABLE_NS_ASSERTIONS = NO; 818 | ENABLE_STRICT_OBJC_MSGSEND = YES; 819 | GCC_C_LANGUAGE_STANDARD = gnu99; 820 | GCC_NO_COMMON_BLOCKS = YES; 821 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 822 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 823 | GCC_WARN_UNDECLARED_SELECTOR = YES; 824 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 825 | GCC_WARN_UNUSED_FUNCTION = YES; 826 | GCC_WARN_UNUSED_VARIABLE = YES; 827 | INFOPLIST_FILE = "$(SRCROOT)/Support/Info.plist"; 828 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 829 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 830 | MTL_ENABLE_DEBUG_INFO = NO; 831 | PRODUCT_BUNDLE_IDENTIFIER = "$(PROJECT_BUNDLE_IDENTIFIER)"; 832 | PRODUCT_NAME = "$(PROJECT_NAME)"; 833 | SDKROOT = appletvos; 834 | SKIP_INSTALL = YES; 835 | TARGETED_DEVICE_FAMILY = 3; 836 | TVOS_DEPLOYMENT_TARGET = 9.0; 837 | VALIDATE_PRODUCT = YES; 838 | VERSIONING_SYSTEM = "apple-generic"; 839 | VERSION_INFO_PREFIX = ""; 840 | }; 841 | name = Release; 842 | }; 843 | 524FEC921C4F45EE0090ADBE /* Debug */ = { 844 | isa = XCBuildConfiguration; 845 | buildSettings = { 846 | ALWAYS_SEARCH_USER_PATHS = NO; 847 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 848 | CLANG_CXX_LIBRARY = "libc++"; 849 | CLANG_ENABLE_MODULES = YES; 850 | CLANG_ENABLE_OBJC_ARC = YES; 851 | CLANG_WARN_BOOL_CONVERSION = YES; 852 | CLANG_WARN_CONSTANT_CONVERSION = YES; 853 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 854 | CLANG_WARN_EMPTY_BODY = YES; 855 | CLANG_WARN_ENUM_CONVERSION = YES; 856 | CLANG_WARN_INT_CONVERSION = YES; 857 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 858 | CLANG_WARN_UNREACHABLE_CODE = YES; 859 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 860 | CODE_SIGN_IDENTITY = "-"; 861 | COMBINE_HIDPI_IMAGES = YES; 862 | COPY_PHASE_STRIP = NO; 863 | DEBUG_INFORMATION_FORMAT = dwarf; 864 | ENABLE_STRICT_OBJC_MSGSEND = YES; 865 | ENABLE_TESTABILITY = YES; 866 | GCC_C_LANGUAGE_STANDARD = gnu99; 867 | GCC_DYNAMIC_NO_PIC = NO; 868 | GCC_NO_COMMON_BLOCKS = YES; 869 | GCC_OPTIMIZATION_LEVEL = 0; 870 | GCC_PREPROCESSOR_DEFINITIONS = ( 871 | "DEBUG=1", 872 | "$(inherited)", 873 | ); 874 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 875 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 876 | GCC_WARN_UNDECLARED_SELECTOR = YES; 877 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 878 | GCC_WARN_UNUSED_FUNCTION = YES; 879 | GCC_WARN_UNUSED_VARIABLE = YES; 880 | INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; 881 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 882 | MACOSX_DEPLOYMENT_TARGET = 10.11; 883 | MTL_ENABLE_DEBUG_INFO = YES; 884 | ONLY_ACTIVE_ARCH = YES; 885 | PRODUCT_BUNDLE_IDENTIFIER = "com.nikolaivazquez.Roman-Tests"; 886 | PRODUCT_NAME = "$(TARGET_NAME)"; 887 | SDKROOT = macosx; 888 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 889 | }; 890 | name = Debug; 891 | }; 892 | 524FEC931C4F45EE0090ADBE /* Release */ = { 893 | isa = XCBuildConfiguration; 894 | buildSettings = { 895 | ALWAYS_SEARCH_USER_PATHS = NO; 896 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 897 | CLANG_CXX_LIBRARY = "libc++"; 898 | CLANG_ENABLE_MODULES = YES; 899 | CLANG_ENABLE_OBJC_ARC = YES; 900 | CLANG_WARN_BOOL_CONVERSION = YES; 901 | CLANG_WARN_CONSTANT_CONVERSION = YES; 902 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 903 | CLANG_WARN_EMPTY_BODY = YES; 904 | CLANG_WARN_ENUM_CONVERSION = YES; 905 | CLANG_WARN_INT_CONVERSION = YES; 906 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 907 | CLANG_WARN_UNREACHABLE_CODE = YES; 908 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 909 | CODE_SIGN_IDENTITY = "-"; 910 | COMBINE_HIDPI_IMAGES = YES; 911 | COPY_PHASE_STRIP = NO; 912 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 913 | ENABLE_NS_ASSERTIONS = NO; 914 | ENABLE_STRICT_OBJC_MSGSEND = YES; 915 | GCC_C_LANGUAGE_STANDARD = gnu99; 916 | GCC_NO_COMMON_BLOCKS = YES; 917 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 918 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 919 | GCC_WARN_UNDECLARED_SELECTOR = YES; 920 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 921 | GCC_WARN_UNUSED_FUNCTION = YES; 922 | GCC_WARN_UNUSED_VARIABLE = YES; 923 | INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; 924 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 925 | MACOSX_DEPLOYMENT_TARGET = 10.11; 926 | MTL_ENABLE_DEBUG_INFO = NO; 927 | PRODUCT_BUNDLE_IDENTIFIER = "com.nikolaivazquez.Roman-Tests"; 928 | PRODUCT_NAME = "$(TARGET_NAME)"; 929 | SDKROOT = macosx; 930 | }; 931 | name = Release; 932 | }; 933 | /* End XCBuildConfiguration section */ 934 | 935 | /* Begin XCConfigurationList section */ 936 | 524FEC421C4E0FD80090ADBE /* Build configuration list for PBXProject "Roman" */ = { 937 | isa = XCConfigurationList; 938 | buildConfigurations = ( 939 | 524FEC431C4E0FD80090ADBE /* Debug */, 940 | 524FEC441C4E0FD80090ADBE /* Release */, 941 | ); 942 | defaultConfigurationIsVisible = 0; 943 | defaultConfigurationName = Release; 944 | }; 945 | 524FEC521C4E0FE80090ADBE /* Build configuration list for PBXNativeTarget "Roman OSX" */ = { 946 | isa = XCConfigurationList; 947 | buildConfigurations = ( 948 | 524FEC501C4E0FE80090ADBE /* Debug */, 949 | 524FEC511C4E0FE80090ADBE /* Release */, 950 | ); 951 | defaultConfigurationIsVisible = 0; 952 | defaultConfigurationName = Release; 953 | }; 954 | 524FEC5D1C4E0FF10090ADBE /* Build configuration list for PBXNativeTarget "Roman iOS" */ = { 955 | isa = XCConfigurationList; 956 | buildConfigurations = ( 957 | 524FEC5E1C4E0FF10090ADBE /* Debug */, 958 | 524FEC5F1C4E0FF10090ADBE /* Release */, 959 | ); 960 | defaultConfigurationIsVisible = 0; 961 | defaultConfigurationName = Release; 962 | }; 963 | 524FEC6A1C4E10030090ADBE /* Build configuration list for PBXNativeTarget "Roman watchOS" */ = { 964 | isa = XCConfigurationList; 965 | buildConfigurations = ( 966 | 524FEC6B1C4E10030090ADBE /* Debug */, 967 | 524FEC6C1C4E10030090ADBE /* Release */, 968 | ); 969 | defaultConfigurationIsVisible = 0; 970 | defaultConfigurationName = Release; 971 | }; 972 | 524FEC771C4E100A0090ADBE /* Build configuration list for PBXNativeTarget "Roman tvOS" */ = { 973 | isa = XCConfigurationList; 974 | buildConfigurations = ( 975 | 524FEC781C4E100A0090ADBE /* Debug */, 976 | 524FEC791C4E100A0090ADBE /* Release */, 977 | ); 978 | defaultConfigurationIsVisible = 0; 979 | defaultConfigurationName = Release; 980 | }; 981 | 524FEC911C4F45EE0090ADBE /* Build configuration list for PBXNativeTarget "Roman Tests" */ = { 982 | isa = XCConfigurationList; 983 | buildConfigurations = ( 984 | 524FEC921C4F45EE0090ADBE /* Debug */, 985 | 524FEC931C4F45EE0090ADBE /* Release */, 986 | ); 987 | defaultConfigurationIsVisible = 0; 988 | defaultConfigurationName = Release; 989 | }; 990 | /* End XCConfigurationList section */ 991 | }; 992 | rootObject = 524FEC3F1C4E0FD80090ADBE /* Project object */; 993 | } 994 | -------------------------------------------------------------------------------- /Roman.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Roman.xcodeproj/xcshareddata/xcschemes/Roman OSX.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 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /Roman.xcodeproj/xcshareddata/xcschemes/Roman iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Roman.xcodeproj/xcshareddata/xcschemes/Roman tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Roman.xcodeproj/xcshareddata/xcschemes/Roman watchOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Sources/Roman.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Roman.swift 3 | // Roman 4 | // 5 | // The MIT License (MIT) 6 | // 7 | // Copyright (c) 2016 Nikolai Vazquez 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | private let _pairs: [(String, IntMax)] = _orderedPairs().filter({ $0.0 != "M" }) 29 | 30 | private func _numeralPairs() -> [String: I] { 31 | return [ 32 | "M": 1000, 33 | "CM": 900, 34 | "D": 500, 35 | "CD": 400, 36 | "C": 100, 37 | "XC": 90, 38 | "L": 50, 39 | "XL": 40, 40 | "X": 10, 41 | "IX": 9, 42 | "V": 5, 43 | "IV": 4, 44 | "I": 1 45 | ] 46 | } 47 | 48 | private func _orderedPairs() -> [(String, I)] { 49 | return _numeralPairs().sort({ $0.1 > $1.1 }) 50 | } 51 | 52 | private func _with(first: T?, _ second: T?, combine: (T, T) -> T?) -> T? { 53 | guard let first = first, second = second else { 54 | return nil 55 | } 56 | return combine(first, second) 57 | } 58 | 59 | private func _repeat(string: String, count: Int) -> String { 60 | func repeatString(string: String, count: Int) -> String { 61 | return Repeat(count: count, repeatedValue: string) 62 | .reduce("", combine: +) 63 | } 64 | let values = [ 65 | 10000, 7000, 5000, 3000, 2000, 66 | 1000, 700, 500, 300, 200, 67 | 100, 70, 50, 30, 20, 68 | 10, 7, 5, 3, 2 69 | ] 70 | for value in values { 71 | if count % value == 0 { 72 | return repeatString( 73 | repeatString(string, count: value), 74 | count: count / value 75 | ) 76 | } 77 | } 78 | return string + _repeat(string, count: count - 1) 79 | } 80 | 81 | private func _createFrom(integer: I) -> String { 82 | let int = integer.toIntMax() 83 | if int >= 1000 { 84 | let values = _repeat("M", count: Int(int / 1000)) 85 | return values + _createFrom(integer % 1000) 86 | } else { 87 | for (numeral, value) in _pairs { 88 | if int >= value { 89 | return numeral + _createFrom(int - value) 90 | } 91 | } 92 | return "" 93 | } 94 | } 95 | 96 | extension String { 97 | 98 | private subscript(range: Range) -> String { 99 | return self[startIndex.advancedBy(range.startIndex) 100 | ..< startIndex.advancedBy(range.endIndex)] 101 | } 102 | 103 | /// Create a Roman numeral string from an integer in its most compact form. 104 | /// 105 | /// Returns `nil` if the integer is `<= 0`. 106 | public init?(roman integer: I) { 107 | guard integer > 0 else { 108 | return nil 109 | } 110 | self = _createFrom(integer) 111 | } 112 | 113 | /// Create a Roman numeral string from an integer in its most compact form. 114 | /// 115 | /// Returns `nil` if the integer is `<= 0`. 116 | public init?(roman integer: I?) { 117 | guard let value = integer.flatMap({ String(roman: $0) }) else { 118 | return nil 119 | } 120 | self = value 121 | } 122 | 123 | } 124 | 125 | extension IntegerType { 126 | 127 | /// Create an integer from a valid Roman numeral string. 128 | public init?(roman numeral: String) { 129 | 130 | guard !numeral.isEmpty else { 131 | return nil 132 | } 133 | 134 | typealias Integer = Self 135 | let pairs: [String: Self] = _numeralPairs() 136 | 137 | func createFrom(numeral: String) -> Integer? { 138 | guard !numeral.isEmpty else { 139 | return 0 140 | } 141 | for index in [2, 1] { 142 | let count = numeral.characters.count 143 | guard index <= count else { 144 | continue 145 | } 146 | let head = numeral[0 ..< index] 147 | guard let value = pairs[head] else { 148 | continue 149 | } 150 | let rest = numeral[index ..< count] 151 | if !rest.isEmpty { 152 | let partValue = rest.characters.count >= 2 153 | ? (pairs[rest[0 ..< 2]] ?? pairs[rest[0 ..< 1]]) 154 | : pairs[rest[0 ..< 1]] 155 | guard partValue <= value else { 156 | return nil 157 | } 158 | } 159 | return _with(value, createFrom(rest), combine: +) 160 | } 161 | return nil 162 | } 163 | 164 | guard let value = createFrom(numeral.uppercaseString) else { 165 | return nil 166 | } 167 | self = value 168 | } 169 | 170 | /// Create an integer from a valid Roman numeral string. 171 | public init?(roman numeral: String?) { 172 | guard let value = numeral.flatMap({ Self(roman: $0) }) else { 173 | return nil 174 | } 175 | self = value 176 | } 177 | 178 | } 179 | 180 | extension FloatingPointType { 181 | 182 | /// Create an instance from a valid Roman numeral string. 183 | public init?(roman numeral: String) { 184 | guard let value = Int(roman: numeral).flatMap({ Self($0) }) else { 185 | return nil 186 | } 187 | self = value 188 | } 189 | 190 | /// Create an instance from a valid Roman numeral string. 191 | public init?(roman numeral: String?) { 192 | guard let value = numeral.flatMap({ Self(roman: $0) }) else { 193 | return nil 194 | } 195 | self = value 196 | } 197 | 198 | } 199 | -------------------------------------------------------------------------------- /Support/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Tests/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 | -------------------------------------------------------------------------------- /Tests/RomanTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RomanTests.swift 3 | // Roman 4 | // 5 | // The MIT License (MIT) 6 | // 7 | // Copyright (c) 2016 Nikolai Vazquez 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | import XCTest 29 | import Roman 30 | 31 | class RomanTests: XCTestCase { 32 | 33 | let examples: [(Int, String?)] = [ 34 | (0, nil), 35 | (1, "I"), 36 | (2, "II"), 37 | (3, "III"), 38 | (4, "IV"), 39 | (5, "V"), 40 | (6, "VI"), 41 | (7, "VII"), 42 | (8, "VIII"), 43 | (9, "IX"), 44 | (10, "X"), 45 | (14, "XIV"), 46 | (15, "XV"), 47 | (19, "XIX"), 48 | (20, "XX"), 49 | (40, "XL"), 50 | (44, "XLIV"), 51 | (50, "L"), 52 | (51, "LI"), 53 | (93, "XCIII"), 54 | (100, "C"), 55 | (150, "CL"), 56 | (320, "CCCXX"), 57 | (500, "D"), 58 | (550, "DL"), 59 | (1000, "M"), 60 | (3000, "MMM"), 61 | (4124, "MMMMCXXIV") 62 | ] 63 | 64 | func testNumeralFromInteger() { 65 | for (integer, numeral) in examples { 66 | XCTAssertEqual(String(roman: integer), numeral) 67 | } 68 | } 69 | 70 | func testIntegerFromNumeral() { 71 | for (integer, numeral) in examples { 72 | XCTAssertEqual(Int(roman: numeral) ?? 0, integer) 73 | } 74 | } 75 | 76 | func testInvalidNumerals() { 77 | let invalid = [ 78 | "IVV", 79 | "IVX", 80 | "IXX", 81 | "IIX", 82 | "Hello", 83 | "XXM" 84 | ] 85 | for numeral in invalid { 86 | XCTAssertNil(Int(roman: numeral)) 87 | } 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure(2) do |config| 2 | config.vm.box = "ubuntu/trusty64" 3 | config.vm.provision :shell, path: "bootstrap.sh" 4 | end 5 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # A provision script for Vagrant to setup a Swift-ready development environment. 4 | # Author: Nikolai Vazquez (https://github.com/nvzqz) 5 | # Platform: Ubuntu 14.04 (ubuntu/trusty64) 6 | 7 | # Variables 8 | SWIFT_SNAPSHOT="swift-2.2-SNAPSHOT-2016-01-06-a" 9 | SWIFT_SNAPSHOT_URL="https://swift.org/builds/ubuntu1404/$SWIFT_SNAPSHOT/$SWIFT_SNAPSHOT-ubuntu14.04.tar.gz" 10 | SWIFT_SNAPSHOT_TAR="swift_snapshot.tar.gz" 11 | SWIFT_SNAPSHOT_DIR="swift" 12 | 13 | # Update package list 14 | echo "Updating package list..." 15 | apt-get update 16 | 17 | # Install packages 18 | echo "Installing packages..." 19 | apt-get install -y git clang libicu-dev 20 | 21 | # Download the snapshot 22 | echo "Downloading Swift snapshot from $SWIFT_SNAPSHOT_URL" 23 | wget -q -O $SWIFT_SNAPSHOT_TAR $SWIFT_SNAPSHOT_URL 24 | 25 | # Extract the snapshot 26 | echo "Extracting '$SWIFT_SNAPSHOT_TAR' to '$SWIFT_SNAPSHOT_DIR'..." 27 | mkdir -p $SWIFT_SNAPSHOT_DIR && tar xzf $SWIFT_SNAPSHOT_TAR -C $SWIFT_SNAPSHOT_DIR --strip-components=1 28 | 29 | # Set directory permissions 30 | echo "Setting permissions for '$SWIFT_SNAPSHOT_DIR'" 31 | chown -R vagrant $SWIFT_SNAPSHOT_DIR 32 | 33 | # Export swift to $PATH 34 | echo "Adding '$SWIFT_SNAPSHOT_DIR' directory to \$PATH..." 35 | echo "export PATH=/home/vagrant/$SWIFT_SNAPSHOT_DIR/usr/bin:$PATH" >> .profile 36 | 37 | # Remove swift snapshot archive 38 | echo "Cleaning up..." 39 | rm $SWIFT_SNAPSHOT_TAR 40 | 41 | # Finished 42 | echo "Successfully installed Swift!" 43 | --------------------------------------------------------------------------------