From 6dc6a6d108ecc9735bcafcb600684074d7043ef6 Mon Sep 17 00:00:00 2001 From: Chris Jennewein Date: Sat, 4 Jul 2020 16:57:09 -0700 Subject: [PATCH] Fix: Swift Package Name typo fix - Update README - Remove local podspec (meant to push to trunk) --- CHANGELOG.md | 2 + Package.swift | 4 +- PokemonAPI/6.0.0/PokemonAPI.podspec | 44 -------------------- README.md | 63 +++++++++++++++++++---------- 4 files changed, 46 insertions(+), 67 deletions(-) delete mode 100644 PokemonAPI/6.0.0/PokemonAPI.podspec diff --git a/CHANGELOG.md b/CHANGELOG.md index 18477a8..b5cbf92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ Refactored network and web service architecture Reorganized project files +Supports Swift Package Manager + ## 5.0.0 Updated for Swift 5 diff --git a/Package.swift b/Package.swift index cba3762..cf4d8ec 100644 --- a/Package.swift +++ b/Package.swift @@ -2,7 +2,7 @@ import PackageDescription let package = Package( - name: "PokemomAPI", + name: "PokemonAPI", platforms: [ .macOS(.v10_11), .iOS(.v11), @@ -10,7 +10,7 @@ let package = Package( .tvOS(.v9), ], products: [ - .library(name: "PokemomAPI", + .library(name: "PokemonAPI", targets: ["PokemonAPI"]), ], targets: [ diff --git a/PokemonAPI/6.0.0/PokemonAPI.podspec b/PokemonAPI/6.0.0/PokemonAPI.podspec deleted file mode 100644 index 5aaaf66..0000000 --- a/PokemonAPI/6.0.0/PokemonAPI.podspec +++ /dev/null @@ -1,44 +0,0 @@ -# -# Be sure to run `pod lib lint PokemonAPI.podspec' to ensure this is a -# valid spec before submitting. -# -# Any lines starting with a # are optional, but their use is encouraged -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html -# - -Pod::Spec.new do |s| - s.name = "PokemonAPI" - s.version = "6.0.0" - s.summary = "A wrapper for pokeapi v2" - -# This description is used to generate tags and improve search results. -# * Think: What does it do? Why did you write it? What is the focus? -# * Try to keep it short, snappy and to the point. -# * Write the description between the DESC delimiters below. -# * Finally, don't worry about the indent, CocoaPods strips it! - s.description = <<-DESC - PokemonAPI is a swift wrapper for PokéAPI (pokeapi.co). - Easily call web services to get info about Pokemon and the Pokemon games. - The framework supports paginated responses, allowing you to quickly get the next results or a specific page. - Linked resources can quickly be turned into their associated classes via a generic `fetch(_ resource:)` function. - All code is Swift native with no third party frameworks. - DESC - - s.homepage = "https://github.com/kinkofer/PokemonAPI" - # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" - s.license = 'MIT' - s.author = { "Christopher Jennewein" => "kinkofer@gmail.com" } - s.source = { :git => "https://github.com/kinkofer/PokemonAPI.git", :tag => s.version.to_s } - s.social_media_url = 'https://twitter.com/kinkofer' - - s.ios.deployment_target = '11.0' - s.osx.deployment_target = '10.11' - s.tvos.deployment_target = '9.2' - s.watchos.deployment_target = '2.2' - - s.swift_version = '5.0' - - s.requires_arc = true - - s.source_files = 'PokemonAPI/Classes/**/*', 'PokemonAPI/Network/**/*', 'PokemonAPI/Utilities/**/*', 'PokemonAPI/WebServices/**/*' -end diff --git a/README.md b/README.md index f89e128..a214d15 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # PokemonAPI [![Build Status](https://travis-ci.org/kinkofer/PokemonAPI.svg?branch=master)](https://travis-ci.org/kinkofer/PokemonAPI) -[![Version](https://img.shields.io/cocoapods/v/PokemonAPI.svg?style=flat)](http://cocoapods.org/pods/PokemonAPI) [![License](https://img.shields.io/cocoapods/l/PokemonAPI.svg?style=flat)](http://cocoapods.org/pods/PokemonAPI) [![Platform](https://img.shields.io/cocoapods/p/PokemonAPI.svg?style=flat)](http://cocoapods.org/pods/PokemonAPI) +[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) +[![Version](https://img.shields.io/cocoapods/v/PokemonAPI.svg?style=flat)](http://cocoapods.org/pods/PokemonAPI) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) ## What is this? @@ -37,6 +38,30 @@ Fetching lists will return a `PagedObject` containing a page of results, plus Web service functions for lists take a `PaginationState` enum parameter. There are two cases for this enum, `.initial(pageLimit: Int)` for the first call, and `.continuing(PKMPagedObject, PaginationRelationship)` for subsequent calls. Each function sets a default value of `.initial(pageLimit: 20)`, but you can pass your own page limit. After the first call, you use `.continuing()` with the PagedObject from the last response, and a `PaginationRelationship` for navigation (`.next`, `.previous`, `.first`, `.last`, or a specific `.page(Int)`). +### Network Calls + +Allow your app to make calls to PokéAPI (pokeapi.co) by making an App Transport Security domain exception. + +In your Info.plist, add +```plist +NSAppTransportSecurity + + NSExceptionDomains + + pokeapi.co + + NSIncludesSubdomains + + NSTemporaryExceptionAllowsInsecureHTTPLoads + + NSTemporaryExceptionMinimumTLSVersion + TLSv1.2 + + + +``` + + ## Examples ```swift @@ -52,7 +77,7 @@ PokemonAPI().berryService.fetchBerry(1) { result in } } -// Same example using Combine +// Same example using Combine. Don't forget to store your cancellable. let cancellable = PokemonAPI().berryService.fetchBerry(1) .sink(receiveCompletion: { completion in if case .failure(let error) = completion { @@ -128,6 +153,18 @@ PokemonAPI().utilityService.fetchLanguageList(paginationState: .initial(pageLimi ## Installation +### Swift Package Manager + +Search for this repository URL in Xcode: + +File->Swift Packages->Add Package Dependency... + +``` +https://github.com/kinkofer/PokemonAPI +``` + +### Cocoapods + PokemonAPI is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: @@ -135,31 +172,15 @@ it, simply add the following line to your Podfile: pod 'PokemonAPI' ``` + +### Carthage + If you're using Carthage you can add PokemonAPI by adding it to your Cartfile: ```ruby github "kinkofer/PokemonAPI" ~> 6.0.0 ``` -In your Info.plist, add -```plist -NSAppTransportSecurity - - NSExceptionDomains - - pokeapi.co - - NSIncludesSubdomains - - NSTemporaryExceptionAllowsInsecureHTTPLoads - - NSTemporaryExceptionMinimumTLSVersion - TLSv1.2 - - - -``` - ## Author Christopher Jennewein, kinkofer@gmail.com