Skip to content

Commit

Permalink
added ios framework target
Browse files Browse the repository at this point in the history
  • Loading branch information
vasily-popov committed Sep 26, 2017
1 parent 1251306 commit 74caecf
Show file tree
Hide file tree
Showing 14 changed files with 411 additions and 80 deletions.
8 changes: 7 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ platform :ios, '9.0'
inhibit_all_warnings!

target 'VPSocketIO' do
pod 'jetfire', :git => 'https://github.com/acmacalister/jetfire.git', :tag => '0.1.6'
pod 'jetfire'
end

target 'VPSocketIO-iOS' do
pod 'jetfire'
end


12 changes: 2 additions & 10 deletions Source/DefaultSocketLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@
//

#import <Foundation/Foundation.h>

@interface SocketLogger:NSObject

@property (nonatomic) BOOL log;

-(void) log:(NSString*)message type:(NSString*)type;
-(void) error:(NSString*)message type:(NSString*)type;

@end
#import "VPSocketLogger.h"

@interface DefaultSocketLogger:NSObject

@property (class) SocketLogger *logger;
@property (class) VPSocketLogger *logger;

@end
39 changes: 4 additions & 35 deletions Source/DefaultSocketLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,19 @@

#import "DefaultSocketLogger.h"


@implementation SocketLogger

- (instancetype)init
{
self = [super init];
if (self) {
self.log = NO;
}
return self;
}

-(void) log:(NSString*)message type:(NSString*)type
{
[self printLog:@"LOG" message:message type:type];
}
-(void) error:(NSString*)message type:(NSString*)type
{
[self printLog:@"ERROR" message:message type:type];
}

-(void) printLog:(NSString*)logType message:(NSString*)message type:(NSString*)type
{
if(_log) {
NSLog(@"%@ %@: %@", logType, type, message);
}

}

@end

@implementation DefaultSocketLogger

static SocketLogger *logInstance;
static VPSocketLogger *logInstance;

+(void)setLogger:(SocketLogger*)newLogger {
+(void)setLogger:(VPSocketLogger*)newLogger {
logInstance = newLogger;
}

+(SocketLogger*)logger {
+(VPSocketLogger*)logger {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
logInstance = [SocketLogger new];
logInstance = [VPSocketLogger new];
});
return logInstance;

Expand Down
1 change: 1 addition & 0 deletions Source/VPSocketEngine+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "VPSocketEngine.h"
#import <Jetfire/Jetfire.h>

typedef enum : NSUInteger{
VPSocketEnginePacketTypeOpen = 0x0,
Expand Down
1 change: 0 additions & 1 deletion Source/VPSocketEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#import "VPSocketEngine+Private.h"
#import "VPSocketEngine+EnginePollable.h"
#import "VPSocketEngine+EngineWebsocket.h"
#import <Jetfire/Jetfire.h>

@interface VPProbe : NSObject

Expand Down
1 change: 0 additions & 1 deletion Source/VPSocketEngineProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define VPSocketEngineProtocol_H

#import <Foundation/Foundation.h>
#import <Jetfire/Jetfire.h>

@protocol VPSocketEngineClient <NSObject>

Expand Down
1 change: 0 additions & 1 deletion Source/VPSocketIOClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

#import <Foundation/Foundation.h>
#import "VPSocketAckEmitter.h"
#import "VPSocketAnyEvent.h"
#import "VPSocketOnAckCallback.h"
#import "VPSocketIOClientProtocol.h"
Expand Down
18 changes: 18 additions & 0 deletions Source/VPSocketLogger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// VPSocketLogger.h
// VPSocketIO
//
// Created by Vasily Popov on 9/26/17.
// Copyright © 2017 Vasily Popov. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface VPSocketLogger:NSObject

@property (nonatomic) BOOL log;

-(void) log:(NSString*)message type:(NSString*)type;
-(void) error:(NSString*)message type:(NSString*)type;

@end
39 changes: 39 additions & 0 deletions Source/VPSocketLogger.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// VPSocketLogger.m
// VPSocketIO
//
// Created by Vasily Popov on 9/26/17.
// Copyright © 2017 Vasily Popov. All rights reserved.
//

#import "VPSocketLogger.h"

@implementation VPSocketLogger

- (instancetype)init
{
self = [super init];
if (self) {
self.log = NO;
}
return self;
}

-(void) log:(NSString*)message type:(NSString*)type
{
[self printLog:@"LOG" message:message type:type];
}
-(void) error:(NSString*)message type:(NSString*)type
{
[self printLog:@"ERROR" message:message type:type];
}

-(void) printLog:(NSString*)logType message:(NSString*)message type:(NSString*)type
{
if(_log) {
NSLog(@"%@ %@: %@", logType, type, message);
}

}

@end
24 changes: 24 additions & 0 deletions VPSocketIO-iOS/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
23 changes: 23 additions & 0 deletions VPSocketIO-iOS/VPSocketIO_iOS.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// VPSocketIO_iOS.h
// VPSocketIO-iOS
//
// Created by Vasily Popov on 9/26/17.
// Copyright © 2017 Vasily Popov. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for VPSocketIO_iOS.
FOUNDATION_EXPORT double VPSocketIO_iOSVersionNumber;

//! Project version string for VPSocketIO_iOS.
FOUNDATION_EXPORT const unsigned char VPSocketIO_iOSVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <VPSocketIO_iOS/PublicHeader.h>

#import <VPSocketIO_iOS/VPSocketIOClient.h>
#import <VPSocketIO_iOS/VPSocketOnAckCallback.h>
#import <VPSocketIO_iOS/VPSocketIOClientProtocol.h>
#import <VPSocketIO_iOS/VPSocketLogger.h>

23 changes: 23 additions & 0 deletions VPSocketIO.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Pod::Spec.new do |s|
s.name = "VPSocketIO"
s.module_name = "SocketIO"
s.version = "1.0.0"
s.summary = "Socket.IO-client for iOS and OS X"
s.description = <<-DESC
Socket.IO-client for iOS and OS X.
Supports ws/wss/polling connections and binary.
For socket.io 2.0+ and Objective-C.
DESC
s.license = { :type => 'MIT' }
s.author = { "Vasily Popov" => "vasily.popov.it@gmail.com" }
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '9.0'
s.requires_arc = true
s.source = {
:git => "https://github.com/vascome/VPSocketIO.git",
:tag => "#{s.version}"
}
s.source_files = "Source/*.h", "Source/*.m"
# s.dependency "jetfire", git => "https://github.com/acmacalister/jetfire.git", tag => "0.1.6"
end
Loading

0 comments on commit 74caecf

Please sign in to comment.