Skip to content

Commit

Permalink
Swift Package Manager Support
Browse files Browse the repository at this point in the history
  • Loading branch information
swhitty committed Feb 20, 2021
1 parent b0c31e2 commit b5cccc7
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 26 deletions.
7 changes: 6 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import PackageDescription

let package = Package(
name: "Bagel",
platforms: [
.iOS(.v9),
.macOS(.v10_10),
],
products: [
.library(name: "Bagel", targets: ["Bagel"])
],
Expand All @@ -13,7 +17,8 @@ let package = Package(
.target(
name: "Bagel",
dependencies: ["CocoaAsyncSocket"],
path: "iOS/Source"
path: "iOS/Source",
publicHeadersPath: ""
)
]
)
4 changes: 2 additions & 2 deletions iOS/Bagel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
3760A46921F1383F004D1E07 /* BagelRequestCarrier.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A44F21F1383F004D1E07 /* BagelRequestCarrier.h */; };
3760A46A21F1383F004D1E07 /* BagelDeviceModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45021F1383F004D1E07 /* BagelDeviceModel.h */; settings = {ATTRIBUTES = (Public, ); }; };
3760A46B21F1383F004D1E07 /* BagelProjectModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3760A45121F1383F004D1E07 /* BagelProjectModel.m */; };
3760A46C21F1383F004D1E07 /* BagelUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45221F1383F004D1E07 /* BagelUtility.h */; settings = {ATTRIBUTES = (Public, ); }; };
3760A46C21F1383F004D1E07 /* BagelUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45221F1383F004D1E07 /* BagelUtility.h */; };
3760A46D21F1383F004D1E07 /* BagelURLSessionInjector.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45321F1383F004D1E07 /* BagelURLSessionInjector.h */; };
3760A46E21F1383F004D1E07 /* BagelRequestInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45421F1383F004D1E07 /* BagelRequestInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
3760A46F21F1383F004D1E07 /* Bagel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45521F1383F004D1E07 /* Bagel.h */; settings = {ATTRIBUTES = (Public, ); }; };
3760A47021F1383F004D1E07 /* BagelConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 3760A45621F1383F004D1E07 /* BagelConfiguration.m */; };
3760A47121F1383F004D1E07 /* BagelRequestPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 3760A45721F1383F004D1E07 /* BagelRequestPacket.m */; };
3760A47221F1383F004D1E07 /* BagelBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45821F1383F004D1E07 /* BagelBrowser.h */; };
3760A47321F1383F004D1E07 /* BagelURLConnectionInjector.m in Sources */ = {isa = PBXBuildFile; fileRef = 3760A45921F1383F004D1E07 /* BagelURLConnectionInjector.m */; };
3760A47421F1383F004D1E07 /* BagelBaseModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45A21F1383F004D1E07 /* BagelBaseModel.h */; settings = {ATTRIBUTES = (Public, ); }; };
3760A47421F1383F004D1E07 /* BagelBaseModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45A21F1383F004D1E07 /* BagelBaseModel.h */; };
3760A47B21F13A47004D1E07 /* CocoaAsyncSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3760A47A21F13A47004D1E07 /* CocoaAsyncSocket.framework */; };
51102CE2220B87290067EB63 /* BagelCarrierDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51102CE1220B857E0067EB63 /* BagelCarrierDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
Expand Down
14 changes: 6 additions & 8 deletions iOS/Source/Bagel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,20 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <UIKit/UIKit.h>
@import Foundation;

//! Project version number for Bagel.
FOUNDATION_EXPORT double BagelVersionNumber;

//! Project version string for Bagel.
FOUNDATION_EXPORT const unsigned char BagelVersionString[];

#import <Foundation/Foundation.h>
@import Foundation;

#import <Bagel/BagelBaseModel.h>
#import <Bagel/BagelCarrierDelegate.h>
#import <Bagel/BagelConfiguration.h>
#import <Bagel/BagelDeviceModel.h>
#import <Bagel/BagelProjectModel.h>
#import <Bagel/BagelUtility.h>
#import "BagelCarrierDelegate.h"
#import "BagelConfiguration.h"
#import "BagelDeviceModel.h"
#import "BagelProjectModel.h"

@interface Bagel : NSObject

Expand Down
2 changes: 1 addition & 1 deletion iOS/Source/BagelBaseModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>
@import Foundation;

@protocol BagelBaseModelProtocol <NSObject>

Expand Down
10 changes: 5 additions & 5 deletions iOS/Source/BagelConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>
#import "BagelCarrierDelegate.h"
#import "BagelProjectModel.h"
#import "BagelDeviceModel.h"
#import "BagelUtility.h"
@import Foundation;

@class BagelProjectModel;
@class BagelDeviceModel;
@protocol BagelCarrierDelegate;

@interface BagelConfiguration : NSObject

Expand Down
3 changes: 3 additions & 0 deletions iOS/Source/BagelConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
// THE SOFTWARE.

#import "BagelConfiguration.h"
#import "BagelProjectModel.h"
#import "BagelDeviceModel.h"
#import "BagelUtility.h"

static BagelConfiguration* defaultConfiguration;

Expand Down
1 change: 1 addition & 0 deletions iOS/Source/BagelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// THE SOFTWARE.

#import "BagelController.h"
#import "BagelCarrierDelegate.h"

static NSString* queueId = @"com.yagiz.bagel.injectController";

Expand Down
4 changes: 2 additions & 2 deletions iOS/Source/BagelDeviceModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "BagelBaseModel.h"
@import Foundation;

@interface BagelDeviceModel : NSObject <BagelBaseModelProtocol>
@interface BagelDeviceModel : NSObject

@property (nonatomic, strong) NSString* deviceId;
@property (nonatomic, strong) NSString* deviceName;
Expand Down
4 changes: 2 additions & 2 deletions iOS/Source/BagelProjectModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "BagelBaseModel.h"
@import Foundation;

@interface BagelProjectModel : NSObject <BagelBaseModelProtocol>
@interface BagelProjectModel : NSObject

@property (nonatomic, strong) NSString* projectName;

Expand Down
7 changes: 7 additions & 0 deletions iOS/Source/BagelRequestPacket.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
// THE SOFTWARE.

#import "BagelRequestPacket.h"
#import "BagelBaseModel.h"

@interface BagelProjectModel()<BagelBaseModelProtocol>
@end

@interface BagelDeviceModel()<BagelBaseModelProtocol>
@end

@implementation BagelRequestPacket

Expand Down
3 changes: 1 addition & 2 deletions iOS/Source/BagelUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@import Foundation;

@interface BagelUtility : NSObject

Expand Down
19 changes: 16 additions & 3 deletions iOS/Source/BagelUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

@import Foundation;

#if TARGET_OS_IOS
@import UIKit;
#endif

#import "BagelUtility.h"

@implementation BagelUtility
Expand All @@ -40,17 +46,24 @@ + (NSString*)deviceId

+ (NSString*)deviceName
{
return [UIDevice currentDevice].name;
#if TARGET_OS_IOS
return [UIDevice currentDevice].name;
#else
return [[NSHost currentHost] localizedName];;
#endif
}

+ (NSString*)deviceDescription
{
NSString* information = @"";
NSString* information = nil;

#if TARGET_OS_IOS
information = [UIDevice currentDevice].model;
information = [NSString stringWithFormat:@"%@ %@", information, [UIDevice currentDevice].systemName];
information = [NSString stringWithFormat:@"%@ %@", information, [UIDevice currentDevice].systemVersion];

#else
information = [[NSProcessInfo processInfo] operatingSystemVersionString];
#endif
return information;
}

Expand Down

0 comments on commit b5cccc7

Please sign in to comment.