Skip to content

Commit

Permalink
Merge pull request #870 from SRGSSR/spm
Browse files Browse the repository at this point in the history
Swift Package Manager support
  • Loading branch information
robb committed Oct 5, 2020
2 parents 583ce3a + 2c0df36 commit d123b3a
Show file tree
Hide file tree
Showing 23 changed files with 102 additions and 34 deletions.
6 changes: 3 additions & 3 deletions Mantle.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
},
"requires_arc": true,
"frameworks": "Foundation",
"source_files": "Mantle",
"source_files": ["Mantle", "Mantle/include"],
"subspecs": [
{
"name": "extobjc",
"source_files": "Mantle/extobjc",
"private_header_files": "Mantle/extobjc/*.h"
"source_files": ["Mantle/extobjc", "Mantle/extobjc/include/*.h"],
"private_header_files": "Mantle/extobjc/include/*.h"
}
]
}
50 changes: 25 additions & 25 deletions Mantle.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Mantle/MTLJSONAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#import "NSDictionary+MTLJSONKeyPath.h"

#import <Mantle/EXTRuntimeExtensions.h>
#import <Mantle/EXTScope.h>
#import "EXTRuntimeExtensions.h"
#import "EXTScope.h"
#import "MTLJSONAdapter.h"
#import "MTLModel.h"
#import "MTLTransformerErrorHandling.h"
Expand Down
4 changes: 2 additions & 2 deletions Mantle/MTLModel+NSCoding.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// Copyright (c) 2013 GitHub. All rights reserved.
//

#import "EXTRuntimeExtensions.h"
#import "EXTScope.h"
#import "MTLModel+NSCoding.h"
#import <Mantle/EXTRuntimeExtensions.h>
#import <Mantle/EXTScope.h>
#import "MTLReflection.h"

// Used in archives to store the modelVersion of the archived instance.
Expand Down
4 changes: 2 additions & 2 deletions Mantle/MTLModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// Copyright (c) 2012 GitHub. All rights reserved.
//

#import "EXTRuntimeExtensions.h"
#import "EXTScope.h"
#import "NSError+MTLModelException.h"
#import "MTLModel.h"
#import <Mantle/EXTRuntimeExtensions.h>
#import <Mantle/EXTScope.h>
#import "MTLReflection.h"
#import <objc/runtime.h>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
// Copyright (c) 2013 GitHub. All rights reserved.
//

#if __has_include(<Mantle/MTLModel.h>)
#import <Mantle/MTLModel.h>
#else
#import "MTLModel.h"
#endif

/// Defines how a MTLModel property key should be encoded into an archive.
///
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

#import <Foundation/Foundation.h>

#if __has_include(<Mantle/MTLTransformerErrorHandling.h>)
#import <Mantle/MTLTransformerErrorHandling.h>
#else
#import "MTLTransformerErrorHandling.h"
#endif

/// A block that represents a transformation.
///
Expand Down
14 changes: 14 additions & 0 deletions Mantle/Mantle.h → Mantle/include/Mantle.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ FOUNDATION_EXPORT double MantleVersionNumber;
//! Project version string for Mantle.
FOUNDATION_EXPORT const unsigned char MantleVersionString[];

#if __has_include(<Mantle/Mantle.h>)
#import <Mantle/MTLJSONAdapter.h>
#import <Mantle/MTLModel.h>
#import <Mantle/MTLModel+NSCoding.h>
Expand All @@ -25,3 +26,16 @@ FOUNDATION_EXPORT const unsigned char MantleVersionString[];
#import <Mantle/NSObject+MTLComparisonAdditions.h>
#import <Mantle/NSValueTransformer+MTLInversionAdditions.h>
#import <Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h>
#else
#import "MTLJSONAdapter.h"
#import "MTLModel.h"
#import "MTLModel+NSCoding.h"
#import "MTLValueTransformer.h"
#import "MTLTransformerErrorHandling.h"
#import "NSArray+MTLManipulationAdditions.h"
#import "NSDictionary+MTLManipulationAdditions.h"
#import "NSDictionary+MTLMappingAdditions.h"
#import "NSObject+MTLComparisonAdditions.h"
#import "NSValueTransformer+MTLInversionAdditions.h"
#import "NSValueTransformer+MTLPredefinedTransformerAdditions.h"
#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

#import <Foundation/Foundation.h>

#if __has_include(<Mantle/MTLTransformerErrorHandling.h>)
#import <Mantle/MTLTransformerErrorHandling.h>
#else
#import "MTLTransformerErrorHandling.h"
#endif

/// The name for a value transformer that converts strings into URLs and back.
extern NSString * const MTLURLValueTransformerName;
Expand Down
31 changes: 31 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version:5.1

import PackageDescription

let package = Package(
name: "Mantle",
platforms: [
.macOS(.v10_10),
.iOS(.v8),
.tvOS(.v9),
.watchOS(.v2)
],
products: [
.library(
name: "Mantle",
targets: ["Mantle"]
)
],
targets: [
.target(
name: "Mantle",
dependencies: ["extobjc"],
path: "Mantle",
exclude: ["extobjc"]
),
.target(
name: "extobjc",
path: "Mantle/extobjc"
)
]
)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Mantle.svg)](https://img.shields.io/cocoapods/v/Mantle.svg)
[![SPM compatible](https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat)](https://swift.org/package-manager)
[![Platform](https://img.shields.io/cocoapods/p/Mantle.svg?style=flat)](http://cocoadocs.org/docsets/Mantle)

Mantle makes it easy to write a simple model layer for your Cocoa or Cocoa Touch application.
Expand Down Expand Up @@ -515,7 +516,17 @@ end

Then run a `pod install` within Terminal or the [CocoaPods app](https://cocoapods.org/app).

### [Swift Package Manager](https://swift.org/package-manager)

If you are writing an application, add Mantle to your project dependencies [directly within Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).

If you are writing a package that requires Mantle as dependency, add it to the `dependencies` list in its `Package.swift` manifest, for example:

```
dependencies: [
.package(url: "https://github.com/Mantle/Mantle.git", .upToNextMajor(from: "2.0.0"))
]
```

## License

Expand Down

0 comments on commit d123b3a

Please sign in to comment.