Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.DS_Store
.build/
.swiftpm/
xcuserdata
project.xcworkspace
/build
Expand Down
3 changes: 2 additions & 1 deletion Frameworks/Tests.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import <GCDWebServers/GCDWebServers.h>
#import <XCTest/XCTest.h>

@import GCDWebServers;

#pragma clang diagnostic ignored "-Weverything" // Prevent "messaging to unqualified id" warnings

@interface Tests : XCTestCase
Expand Down
8 changes: 7 additions & 1 deletion GCDWebUploader/GCDWebUploader.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ @implementation GCDWebUploader

- (instancetype)initWithUploadDirectory:(NSString*)path {
if ((self = [super init])) {
NSString* bundlePath = [[NSBundle bundleForClass:[GCDWebUploader class]] pathForResource:@"GCDWebUploader" ofType:@"bundle"];
#if SWIFT_PACKAGE
NSBundle* bundle = SWIFTPM_MODULE_BUNDLE;
#else
NSBundle* bundle = [NSBundle bundleForClass:[GCDWebUploader class]];
#endif

NSString* bundlePath = [bundle pathForResource:@"GCDWebUploader" ofType:@"bundle"];
if (bundlePath == nil) {
return nil;
}
Expand Down
58 changes: 58 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "GCDWebServer",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "GCDWebServers",
targets: ["GCDWebServers"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "GCDWebServers",
dependencies: [],
path: ".",
exclude: [
"Frameworks",
"iOS",
"Mac",
"Tests",
"tvOS",
"Package.swift",
"GCDWebServer.podspec",
"Run-Tests.sh",
"format-source.sh",
"README.md",
"LICENSE"
],
resources: [
.copy("GCDWebUploader/GCDWebUploader.bundle"),
],
cSettings:[
.headerSearchPath("GCDWebServer/Core"),
.headerSearchPath("GCDWebServer/Requests"),
.headerSearchPath("GCDWebServer/Responses"),
]
),
.testTarget(
name: "GCDWebServersTests",
dependencies: ["GCDWebServers"],
path: "Frameworks",
exclude: [
"GCDWebServers.h",
"Info.plist",
"module.modulemap"
]
),
]
)
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,39 @@ Requirements:
Getting Started
===============

Swift Package Manager
---------------------

1. From the Xcode menu click File > Swift Packages > Add Package Dependency.
2. In the dialog that appears, enter the repository URL: https://github.com/swisspol/GCDWebServer.
3. In Version, select Up to Next Major and take the default option.
4. Choose 'GCDWebServers' in the Package Product column.

If you are developing a SPM package, you must add the following dependency to your Package.swift:
```swift
dependencies: [
.package(url: "https://github.com/swisspol/GCDWebServer", from: "3.5.5"),
]
```

Finally you declare GCDWebServer as a dependency on your target:
```swift
.target(
name: "YOUR_TARGET_NAME",
dependencies: [
.product(name: "GCDWebServers", package: "GCDWebServer"),
]),
```

Manually
---------

Download or check out the [latest release](https://github.com/swisspol/GCDWebServer/releases) of GCDWebServer then add the entire "GCDWebServer" subfolder to your Xcode project. If you intend to use one of the extensions like GCDWebDAVServer or GCDWebUploader, add these subfolders as well. Finally link to `libz` (via Target > Build Phases > Link Binary With Libraries) and add `$(SDKROOT)/usr/include/libxml2` to your header search paths (via Target > Build Settings > HEADER_SEARCH_PATHS).

Alternatively, you can install GCDWebServer using [CocoaPods](http://cocoapods.org/) by simply adding this line to your Podfile:
CocoaPods
---------

You can install GCDWebServer using [CocoaPods](http://cocoapods.org/). Simply add this line to your Podfile:
```
pod "GCDWebServer", "~> 3.0"
```
Expand All @@ -60,6 +90,9 @@ pod "GCDWebServer/WebDAV", "~> 3.0"

And finally run `$ pod install`.

Carthage
---------

You can also use [Carthage](https://github.com/Carthage/Carthage) by adding this line to your Cartfile (3.2.5 is the first release with Carthage support):
```
github "swisspol/GCDWebServer" ~> 3.2.5
Expand Down
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebDAVServer.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServer.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerConnection.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerDataRequest.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerDataResponse.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerErrorResponse.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerFileRequest.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerFileResponse.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerFunctions.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerHTTPStatusCodes.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerMultiPartFormRequest.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerRequest.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerResponse.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerStreamedResponse.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebServerURLEncodedFormRequest.h
1 change: 1 addition & 0 deletions include/GCDWebServers/GCDWebUploader.h