Git Product home page Git Product logo

transformerkit's Issues

Bump pod specs to include cryptographic transformers

Hi Matt,

I saw that you added cryptographic transformers to the TransformerKit – would be super useful for something I'm working on. Is it possible to create a new release so that they're available or aren't they fit for public consumption yet?

Best regards
Jan

TKTIFFRepresentationImageTransformer -> TKTIFFRepresentationImageTransformerName

The project doesn't compile for MacOS. The constant TKTIFFRepresentationImageTransformer is missing.

diff --git a/TransformerKit/TKImageTransformers.m b/TransformerKit/TKImageTransformers.m
index 24e6450..c4e41a2 100644
--- a/TransformerKit/TKImageTransformers.m
+++ b/TransformerKit/TKImageTransformers.m
@@ -81,7 +81,7 @@ static inline NSData * NSImageRepresentationWithType(NSImage *image, NSBitmapIma
         return [[imageClass alloc] initWithData:value];
     }];

-    [NSValueTransformer registerValueTransformerWithName:TKTIFFRepresentationImageTransformer transformedValueClass:imageClass returningTransformedValueWithBlock:^id(id value) {
+    [NSValueTransformer registerValueTransformerWithName:TKTIFFRepresentationImageTransformerName transformedValueClass:imageClass returningTransformedValueWithBlock:^id(id value) {
         return NSImageRepresentationWithType(value, NSTIFFFileType, nil);
     } allowingReverseTransformationWithBlock:^id(id value) {
         return [[imageClass alloc] initWithData:value];

Not Working for iOS

In podspec says:
s.ios.deployment_target = '5.0'
But TransformerKit cannot be compiled for iOS because security framework is required for data transformers for some reason. Security framework on iOS lacks required functions.

Image transformers and scaling.

Currently the image transformers always assume the image has a scale of 1, whereas I want them to have a scale of 2 on retina devices.

I’m currently working around this by overriding my Core Data accessor and creating a new UIImage instance based on the result of the ‘primitive’ reader:

- (UIImage *)thumbnail;
{
  UIImage *thumbnail = self.primitiveThumbnail;
  thumbnail = [UIImage imageWithCGImage:thumbnail.CGImage
                                  scale:[UIScreen mainScreen].scale
                            orientation:thumbnail.imageOrientation];
  return thumbnail;
}

I wonder if you’ve already thought of a solution, I wasn’t able to quickly figure one out, without resorting to a global scale property on the transformer class.

Advice on working with ISO 8601 format and UTC dates

I have been using NSDateFormatter to handle dates in this format: @"2014-02-10T14:57:46.025479".

I recently ran into the issue that sometimes milliseconds are omitted, like so: @"2014-02-28T17:46:24" and decided to try and leverage TransformerKit to handle this.

While it appears to accept the varying ISO 8601 formats I need, I'm now having the issue that the results are shifted by 5 hours.

Perhaps I'm approaching this the wrong way or testing things incorrectly.

Below is an example. Thanks in advance.

Interface:

#import <Foundation/Foundation.h>

@interface MyClass : NSObject

+ (NSDate *)dateFromString:(NSString *)string;
+ (NSString *)stringFromDate:(NSDate *)date;

@end

Implementation:

#import "MyClass.h"
#import <TransformerKit/TransformerKit.h>

@implementation MyClass

+ (NSDate *)dateFromString:(NSString *)string
{
    return [[self sharedDateTransformer] reverseTransformedValue:string];
}

+ (NSString *)stringFromDate:(NSDate *)date
{
    return [[self sharedDateTransformer] transformedValue:date];
}

+ (NSValueTransformer *)sharedDateTransformer
{
    static NSValueTransformer *_dateTransformer = nil;
    static dispatch_once_t onceToken;

    dispatch_once(&onceToken, ^{
        _dateTransformer = [NSValueTransformer valueTransformerForName:TTTISO8601DateTransformerName];
    });

    return _dateTransformer;
}

@end

Tests, which all fail:

#import "Specta.h"

#define EXP_SHORTHAND
#import "Expecta.h"

#import "MyClass.h"

SpecBegin(MyClass)

describe(@"MyClass", ^{
    describe(@"formatting dates", ^{
        context(@"converting dates to strings", ^{
            it(@"should parse the date correctly", ^{
                NSString *dateStringFixture = @"1970-01-01T00:00:00Z";
                NSDate *dateFixture = [NSDate dateWithTimeIntervalSince1970:0];
                NSString *dateString = [MyClass stringFromDate:dateFixture];

                // expected: 1970-01-01T00:00:00Z, got: 1969-12-31T19:00:00-0500
                expect(dateString).to.equal(dateStringFixture);
            });
        });

        context(@"converting strings to dates", ^{
            context(@"with milliseconds", ^{
                it(@"should parse the date correctly", ^{
                    NSString *dateStringFixture = @"1970-01-01T00:00:00.000000";
                    NSDate *dateFixture = [NSDate dateWithTimeIntervalSince1970:0];
                    NSDate *date = [MyClass dateFromString:dateStringFixture];

                    // expected: 0, got: -18000
                    expect([dateFixture timeIntervalSinceDate:date]).to.equal(0);
                });
            });

            context(@"without milliseconds", ^{
                it(@"should parse the date correctly", ^{
                    NSString *dateStringFixture = @"1970-01-01T00:00:00";
                    NSDate *dateFixture = [NSDate dateWithTimeIntervalSince1970:0];
                    NSDate *date = [MyClass dateFromString:dateStringFixture];

                    // expected: 0, got: -18000
                    expect([dateFixture timeIntervalSinceDate:date]).to.equal(0);
                });
            });
        });
    });
});

SpecEnd

Crash on Xcode 5 DP5/DP6, allowsReverseTransformationMethod

App crashes running Xcode 5 DP5/DP6,
file: NSValueTransformer+TransformerKit.m
line: 81
allowsReverseTransformationMethod = class_getClassMethod(class, allowsReverseTransformationSelector);

output message:
EXC_BAD_INSTRUCTION: (code=EXC_I386_INVOP)

OS X Linker error

The dependency in the pod file:

ss.osx.frameworks = "CommonCrypto" 

causes a linker failure on OS X 10.9 mavericks:

ld: framework not found CommonCrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)

removing that dependency from the pod spec seems to solve it. Also the example app doesn't need that framework on OS X, so I suspect it's an older-OS requirement? What's odd is that the libCommonCrypto is there in the 10.9 SDK.

TTTISO8601TimestampFromDate date parsing returns (null)

I use TransformerKit in my iOS app with a Rails server:

[[NSValueTransformer valueTransformerForName:TTTISO8601DateTransformerName] transformedValue:[representation valueForKey:@"updated_at"]]

...but the above statement returns (null) on date strings e.g. 2012-09-14T11:00:00+02:00.

0.4.0 does not successfully link in iOS

Just upgraded from 0.3.1 and noticed that 0.4.0 no longer links properly on iOS due to the requirement for the CommonCrypto framework, which does not exist in iOS. Is there a way around this?

Add 0.2.2 Tag for CocoaPods

Hi,

The 0.2.2 tag hasn't been created so CocoaPods breaks.

$ pod install
Analyzing dependencies
Downloading dependencies
Installing AFIncrementalStore (0.4.0)
Installing AFNetworking (1.2.1)
Installing InflectorKit (0.0.1)
Installing TransformerKit (0.2.2)
[!] Pod::Executable fetch origin tags/0.2.2 2>&1

fatal: Couldn't find remote ref tags/0.2.2

fatal: The remote end hung up unexpectedly

Regards,
Kevin

CommonCrypto.framework is not in iOS SDK, error: linker command failed

I use CocoaPods for managing libraries. TransformerKit was added to my workspace as another library (not sure which one) depends on it.

I have this instruction in my Podfile header.
platform :ios, '7.0'

When I tried to compile my application I was getting the linker error code -1 because linker could not find the CommonCrypto framework.

Either the TransformerKit was incorrectly added by the Pod manager or it is not for iOS development.

I have removed the reference from the TransformerKit pod target and I could compile the app.

NSData to video transformation?

I'm storing video in CoreData as NSData...how can I use TransformKit to transform this data back into video when I retrieve it?

TTTISO8601TimestampFromDate doesn't actually work

The example outputs "TTTISO8601DateTransformerName (Timestamp): %2013-%39-%29%" for me.

From the looks of it, you are using strftime format patterns, while NSDateFormatter uses patterns from the Unicode Technical Standard.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.