Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to SwiftPM, delete Xcode project #22

Merged
merged 5 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 6 additions & 47 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,6 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata

## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# Swift Package Manager
Packages/
.build/
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
.swiftpm/xcode/package.xcworkspace
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ matrix:
include:
- os: osx
language: objective-c
osx_image: xcode10.2
env:
- DESTINATION="platform=iOS Simulator,name=iPhone X,OS=12.2"
osx_image: xcode11.1

script:
# Alternatively: set -o pipefail && xcodebuild ... | xcpretty
# The pipefail option sets the exit status to the last command with a non-zero status code, which would usually be xcodebuild.
# But xcpretty may also hide some logs we'd like to see.
- xcodebuild test -scheme Ampere -sdk iphonesimulator -destination "$DESTINATION"
- swift test
581 changes: 0 additions & 581 deletions Ampere.xcodeproj/project.pbxproj

This file was deleted.

7 changes: 0 additions & 7 deletions Ampere.xcodeproj/project.xcworkspace/contents.xcworkspacedata

This file was deleted.

This file was deleted.

114 changes: 0 additions & 114 deletions Ampere.xcodeproj/xcshareddata/xcschemes/Ampere.xcscheme

This file was deleted.

9 changes: 0 additions & 9 deletions Ampere/Ampere.h

This file was deleted.

24 changes: 0 additions & 24 deletions Ampere/Info.plist

This file was deleted.

22 changes: 0 additions & 22 deletions AmpereTests/Info.plist

This file was deleted.

23 changes: 23 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Ampere",
platforms: [.macOS(.v10_12), .iOS(.v10), .tvOS(.v10), .watchOS(.v3)],
products: [
.library(
name: "Ampere",
targets: ["Ampere"]),
],
dependencies: [],
targets: [
.target(
name: "Ampere",
dependencies: []),
.testTarget(
name: "AmpereTests",
dependencies: ["Ampere"]),
]
)
54 changes: 37 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Ampere

By [Ole Begemann][Ole Begemann], July 2016
By [Ole Begemann](https://oleb.net/), July 2016

An iOS library that extends Foundation’s units and measurements APIs with type-safe multiplication and division.

[![Build Status](https://travis-ci.org/ole/Ampere.svg?branch=master)](https://travis-ci.org/ole/Ampere)
A Swift library that extends Foundation’s units and measurements APIs with type-safe multiplication and division.


## Requirements
Expand All @@ -14,7 +12,37 @@ Swift 5.0 or higher.

## Dependencies

Foundation
* Foundation
* On Apple platforms, the minimum deployment targets are (I believe):
- iOS 10
- macOS 10.12
- tvOS 10
- watchOS 3


## Usage

The library is a [Swift Package Manager](https://swift.org/package-manager/) package. Add this line to your `Package.swift` file to add Ampere as a dependency:

~~~swift
let package = Package(
...
dependencies: [
.package(url: "https://github.com/ole/Ampere.git", from: "0.4.0"),
],
...
~~~


In your code, import Ampere like so:

~~~swift
import Ampere
~~~

as an Xcode project that builds an iOS Framework target. I have not (yet) set it up for CocoaPods, Carthage, or the Swift Package Manager. (Although I assume Carthage should build it out of the box.)

Clone the repository, open the project in Xcode, and check out the tests. If you want to use this in your own project in the current form, drag and drop the project file into your Xcode project and add the framework to your linked libraries, or copy the files directly into your project.


## Examples
Expand Down Expand Up @@ -46,13 +74,6 @@ energy.converted(to: .kilowattHours)
Notice that in this case we had to explicitly specify the type of the `energy` variable in `let energy: Measurement<UnitEnergy>`. Sometimes the compiler cannot infer the correct type automatically and we have to help it.


## Usage

The library is packaged as an Xcode project that builds an iOS Framework target. I have not (yet) set it up for CocoaPods, Carthage, or the Swift Package Manager. (Although I assume Carthage should build it out of the box.)

Clone the repository, open the project in Xcode, and check out the tests. If you want to use this in your own project in the current form, drag and drop the project file into your Xcode project and add the framework to your linked libraries, or copy the files directly into your project.


## Additional Units

This library defines the following custom units because they are not included in Foundation:
Expand Down Expand Up @@ -118,9 +139,8 @@ I wrote a series of blog posts about this: [Part 1], [Part 2], [Part 3]. Part 2

## License

MIT License. See LICENSE file for details.
MIT License. See LICENSE.txt file for details.

[Ole Begemann]: http://oleb.net/
[Part 1]: http://oleb.net/blog/2016/07/measurements-and-units/
[Part 2]: http://oleb.net/blog/2016/07/unitproduct/
[Part 3]: http://oleb.net/blog/2016/07/unitsquare/
[Part 1]: https://oleb.net/blog/2016/07/measurements-and-units/
[Part 2]: https://oleb.net/blog/2016/07/unitproduct/
[Part 3]: https://oleb.net/blog/2016/07/unitsquare/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.