Skip to content

Commit

Permalink
Merge pull request #1 from lovoo/feature/swiftpm
Browse files Browse the repository at this point in the history
Swift Package Support
  • Loading branch information
fabianehlert authored Aug 13, 2024
2 parents 87d1f8b + 0f7e867 commit 65adff5
Show file tree
Hide file tree
Showing 89 changed files with 100 additions and 5,798 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ Pods
DerivedData
build

.ruby-version
.ruby-version

.swiftpm
21 changes: 21 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// swift-tools-version: 5.10

import PackageDescription

let package = Package(
name: "pop",
platforms: [.iOS(.v15)],
products: [
.library(
name: "pop",
targets: ["pop"]
)
],
targets: [
.target(
name: "pop",
path: "Sources/pop",
publicHeadersPath: "include"
)
]
)
15 changes: 0 additions & 15 deletions Podfile

This file was deleted.

12 changes: 0 additions & 12 deletions Podfile.lock

This file was deleted.

10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Pop is an extensible animation engine for iOS, tvOS, and OS X. In addition to ba

## Installation

### Swift Package Manager (only supported way)

This fork has been modified to use pop as a Swift Package, the other following ways of installation are **no longer supported**. To use pop as a Swift package import the Package.swift file.

### Cocoapods (deprecated)

Pop is available on [CocoaPods](http://cocoapods.org). Just add the following to your project Podfile:

```ruby
Expand All @@ -18,14 +24,14 @@ Bugs are first fixed in master and then made available via a designated release.
pod 'pop', :git => 'https://github.com/facebook/pop.git'
```

### Framework (manual)
### Framework (manual) (deprecated)
By adding the project to your project and adding pop.embedded framework to the Embedded Binaries section on the General tab of your app's target, you can set up pop in seconds! This also enables `@import pop` syntax with header modules.

**Note**: because of some awkward limitations with Xcode, embedded binaries must share the same name as the module and must have `.framework` as an extension. This means that you'll see three pop.frameworks when adding embedded binaries (one for OS X, one for tvOS, and one for iOS). You'll need to be sure to add the right one; they appear identically in the list but note the list is populated in order of targets. You can verify the correct one was chosen by checking the path next to the framework listed, in the format `<configuration>-<platform>` (e.g. `Debug-iphoneos`).

![Embedded Binaries](Images/EmbeddedBinaries.png?raw=true)

**Note 2**: this method does not currently play nicely with workspaces. Since targets can only depend on and embed products from other targets in the same project, it only works when pop.xcodeproj is added as a subproject to the current target's project. Otherwise, you'll need to manually set the build ordering in the scheme and copy in the product.
**Note 2**: this method does not currently play nicely with workspaces. Since targets can only depend on and embed products from other targets in the same project, it only works when pop.xcodeproj is added as a subproject to the current target's project. Otherwise, you'll need to manually set the build (deprecated)ordering in the scheme and copy in the product.

### Static Library (manual)
Alternatively, you can add the project to your workspace and adopt the provided configuration files or manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including `-lc++` to your project linker flags.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions pop/POPAnimator.mm → Sources/pop/POPAnimator.mm
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ - (void)_renderTime:(CFTimeInterval)time items:(std::list<POPAnimatorItemRef>)it
pthread_mutex_unlock(&_lock);
} else {
// copy list into vector
std::vector<POPAnimatorItemRef> vector{ items.begin(), items.end() };
std::vector<POPAnimatorItemRef> vector(items.begin(), items.end());

// unlock
pthread_mutex_unlock(&_lock);
Expand Down Expand Up @@ -869,7 +869,7 @@ - (void)renderTime:(CFTimeInterval)time

- (void)addObserver:(id<POPAnimatorObserving>)observer
{
NSAssert(nil != observer, @"attempting to add nil %@ observer", self);
NSAssert1(nil != observer, @"attempting to add nil %@ observer", self);
if (nil == observer) {
return;
}
Expand All @@ -891,7 +891,7 @@ - (void)addObserver:(id<POPAnimatorObserving>)observer

- (void)removeObserver:(id<POPAnimatorObserving>)observer
{
NSAssert(nil != observer, @"attempting to remove nil %@ observer", self);
NSAssert1(nil != observer, @"attempting to remove nil %@ observer", self);
if (nil == observer) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ - (instancetype)copyWithZone:(NSZone *)zone {
return copy;
}

@end
@end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions pop/POPVector.mm → Sources/pop/POPVector.mm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

Vector *v = new Vector(count);

NSCAssert(count <= 4, @"unexpected count %lu", (unsigned long)count);
NSCAssert1(count <= 4, @"unexpected count %lu", (unsigned long)count);
for (NSUInteger i = 0; i < MIN(count, (NSUInteger)4); i++) {
v->_values[i] = vec[i];
}
Expand Down Expand Up @@ -216,7 +216,7 @@
return CGAffineTransformIdentity;
}

NSCAssert(size() >= 6, @"unexpected vector size:%lu", (unsigned long)size());
NSCAssert1(size() >= 6, @"unexpected vector size:%lu", (unsigned long)size());
CGAffineTransform t;
t.a = _values[0];
t.b = _values[1];
Expand Down
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions Sources/pop/include/POP.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
Copyright (c) 2014-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
*/

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"

#ifndef POP_POP_H
#define POP_POP_H

#import "POPDefines.h"

#import "POPAnimatableProperty.h"
#import "POPAnimatablePropertyTypes.h"
#import "POPAnimation.h"
#import "POPAnimationEvent.h"
#import "POPAnimationExtras.h"
#import "POPAnimationTracer.h"
#import "POPAnimator.h"
#import "POPBasicAnimation.h"
#import "POPCustomAnimation.h"
#import "POPDecayAnimation.h"
#import "POPGeometry.h"
#import "POPLayerExtras.h"
#import "POPPropertyAnimation.h"
#import "POPSpringAnimation.h"

#endif /* POP_POP_H */

#pragma clang diagnostic pop
2 changes: 1 addition & 1 deletion pop/POPAction.h → Sources/pop/include/POPAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#import <QuartzCore/CATransaction.h>

#import <pop/POPDefines.h>
#import "POPDefines.h"

#ifdef __cplusplus

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

#import <Foundation/NSObject.h>

#import <pop/POPDefines.h>
#import <pop/POPAnimatablePropertyTypes.h>
#import "POPDefines.h"
#import "POPAnimatablePropertyTypes.h"

@class POPMutableAnimatableProperty;

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pop/POPAnimation.h → Sources/pop/include/POPAnimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#import <Foundation/NSObject.h>

#import <pop/POPAnimationTracer.h>
#import <pop/POPGeometry.h>
#import "POPAnimationTracer.h"
#import "POPGeometry.h"

@class CAMediaTimingFunction;

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#import <QuartzCore/CAAnimation.h>

#import <pop/POPDefines.h>
#import <pop/POPSpringAnimation.h>
#import "POPDefines.h"
#import "POPSpringAnimation.h"

/**
@abstract The current drag coefficient.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
of patent rights can be found in the PATENTS file in the same directory.
*/

#import <pop/POPAnimation.h>
#import "POPAnimation.h"

#define POP_ANIMATION_FRICTION_FOR_QC_FRICTION(qcFriction) (25.0 + (((qcFriction - 8.0) / 2.0) * (25.0 - 19.0)))
#define POP_ANIMATION_TENSION_FOR_QC_TENSION(qcTension) (194.0 + (((qcTension - 30.0) / 50.0) * (375.0 - 194.0)))
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import <Foundation/Foundation.h>

#import <pop/POPAnimationEvent.h>
#import "POPAnimationEvent.h"

@class POPAnimation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import <Foundation/Foundation.h>

#import <pop/POPAnimationTracer.h>
#import "POPAnimationTracer.h"

@interface POPAnimationTracer (Internal)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
of patent rights can be found in the PATENTS file in the same directory.
*/

#import <pop/POPAnimator.h>
#import "POPAnimator.h"

@class POPAnimation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
of patent rights can be found in the PATENTS file in the same directory.
*/

#import <pop/POPPropertyAnimation.h>
#import "POPPropertyAnimation.h"

/**
@abstract A concrete basic animation class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ static void interpolate(POPValueType valueType, NSUInteger count, const CGFloat
POPInterpolateVector(count, outVec, fromVec, toVec, p);
break;
default:
NSCAssert(false, @"unhandled type %d", valueType);
NSCAssert1(false, @"unhandled type %d", valueType);
break;
}
}

struct _POPBasicAnimationState : _POPPropertyAnimationState
{
CAMediaTimingFunction *timingFunction;
double timingControlPoints[4];
double timingControlPoints[4] = {0.};
CFTimeInterval duration;
CFTimeInterval timeProgress;

_POPBasicAnimationState(id __unsafe_unretained anim) : _POPPropertyAnimationState(anim),
timingFunction(nil),
timingControlPoints{0.},
timingControlPoints(),
duration(kPOPAnimationDurationDefault),
timeProgress(0.)
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
of patent rights can be found in the PATENTS file in the same directory.
*/

#import <pop/POPAnimation.h>
#import "POPAnimation.h"

@class POPCustomAnimation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
of patent rights can be found in the PATENTS file in the same directory.
*/

#import <pop/POPPropertyAnimation.h>
#import "POPPropertyAnimation.h"

/**
@abstract A concrete decay animation class.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import <QuartzCore/QuartzCore.h>

#import <pop/POPDefines.h>
#import "POPDefines.h"

POP_EXTERN_C_BEGIN

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
of patent rights can be found in the PATENTS file in the same directory.
*/

#import <pop/POPAnimatableProperty.h>
#import <pop/POPAnimation.h>
#import "POPAnimatableProperty.h"
#import "POPAnimation.h"

/**
@abstract Flags for clamping animation values.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
of patent rights can be found in the PATENTS file in the same directory.
*/

#import <pop/POPPropertyAnimation.h>
#import "POPPropertyAnimation.h"

/**
@abstract A concrete spring animation class.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import <Foundation/Foundation.h>

#import <pop/POPVector.h>
#import "POPVector.h"

namespace POP {

Expand Down
2 changes: 1 addition & 1 deletion pop/POPVector.h → Sources/pop/include/POPVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ namespace POP {

// operator overloads
CGFloat &operator[](size_t i) const {
NSCAssert(size() > i, @"unexpected vector size:%lu", (unsigned long)size());
NSCAssert1(size() > i, @"unexpected vector size:%lu", (unsigned long)size());
return _values[i];
}

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions Sources/pop/include/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module pop {
header "POP.h"
export *
}
28 changes: 0 additions & 28 deletions pop-tests/POPAnimatable.h

This file was deleted.

Loading

0 comments on commit 65adff5

Please sign in to comment.