From 335e877b2dde693a405d0268347ae941af4f45cf Mon Sep 17 00:00:00 2001 From: skipp Date: Mon, 28 Mar 2022 19:17:16 +0700 Subject: [PATCH] Add Support swift package --- .gitignore | 2 + .../contents.xcworkspacedata | 7 ++ .../xcschemes/SWRevealViewController.xcscheme | 67 +++++++++++++++++++ Package.swift | 40 +++++++++++ .../project.pbxproj | 1 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../SWRevealViewController.m | 7 +- .../include}/SWRevealViewController.h | 7 +- .../SWRevealViewControllerTests.swift | 11 +++ 10 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/SWRevealViewController.xcscheme create mode 100644 Package.swift create mode 100644 RevealControllerExample/RevealControllerProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 RevealControllerExample3/RevealControllerProject3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename {SWRevealViewController => Sources}/SWRevealViewController.m (99%) rename {SWRevealViewController => Sources/include}/SWRevealViewController.h (99%) create mode 100644 Tests/SWRevealViewControllerTests/SWRevealViewControllerTests.swift diff --git a/.gitignore b/.gitignore index 918efde..5dcfeb0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ DerivedData # CocoaPods Pods + +.build diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/SWRevealViewController.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/SWRevealViewController.xcscheme new file mode 100644 index 0000000..00c4d0d --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/SWRevealViewController.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..f218841 --- /dev/null +++ b/Package.swift @@ -0,0 +1,40 @@ +// swift-tools-version: 5.4 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SWRevealViewController", + platforms: [ + .iOS(.v10) + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "SWRevealViewController", + targets: ["SWRevealViewController"] + ), + ], + 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 this package depends on. + .target( + name: "SWRevealViewController", + dependencies: [], + path: "Sources", + publicHeadersPath: "include", + cSettings: [ + .headerSearchPath("**") + ] + ) + ], + swiftLanguageVersions: [ + .v4, + .v4_2, + .v5, + ] +) diff --git a/RevealControllerExample/RevealControllerProject.xcodeproj/project.pbxproj b/RevealControllerExample/RevealControllerProject.xcodeproj/project.pbxproj index c00cd79..30dfc6e 100755 --- a/RevealControllerExample/RevealControllerProject.xcodeproj/project.pbxproj +++ b/RevealControllerExample/RevealControllerProject.xcodeproj/project.pbxproj @@ -243,6 +243,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 5E605B9A14A081F900853025; diff --git a/RevealControllerExample/RevealControllerProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/RevealControllerExample/RevealControllerProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/RevealControllerExample/RevealControllerProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/RevealControllerExample3/RevealControllerProject3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/RevealControllerExample3/RevealControllerProject3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/RevealControllerExample3/RevealControllerProject3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SWRevealViewController/SWRevealViewController.m b/Sources/SWRevealViewController.m similarity index 99% rename from SWRevealViewController/SWRevealViewController.m rename to Sources/SWRevealViewController.m index d378d13..7cbca47 100755 --- a/SWRevealViewController/SWRevealViewController.m +++ b/Sources/SWRevealViewController.m @@ -26,8 +26,10 @@ Early code inspired on a similar class by Philip Kluz (Philip.Kluz@zuui.org) #import -#import "SWRevealViewController.h" +#import "include/SWRevealViewController.h" +#if TARGET_OS_IOS +@import UIKit; #pragma mark - StatusBar Helper Function @@ -1932,5 +1934,4 @@ - (void)perform //} // //@end - - +#endif diff --git a/SWRevealViewController/SWRevealViewController.h b/Sources/include/SWRevealViewController.h similarity index 99% rename from SWRevealViewController/SWRevealViewController.h rename to Sources/include/SWRevealViewController.h index 345dfaa..c122468 100755 --- a/SWRevealViewController/SWRevealViewController.h +++ b/Sources/include/SWRevealViewController.h @@ -136,8 +136,10 @@ */ - -#import +@import Foundation; +@import CoreGraphics; +#if TARGET_OS_IOS +@import UIKit; @class SWRevealViewController; @protocol SWRevealViewControllerDelegate; @@ -420,3 +422,4 @@ extern NSString* const SWSegueRightIdentifier; // this is @"sw_right" //@interface SWRevealViewControllerSegue : UIStoryboardSegue // DEPRECATED: USE SWRevealViewControllerSegueSetController instead //@property (nonatomic, strong) void(^performBlock)( SWRevealViewControllerSegue* segue, UIViewController* svc, UIViewController* dvc ); //@end +#endif diff --git a/Tests/SWRevealViewControllerTests/SWRevealViewControllerTests.swift b/Tests/SWRevealViewControllerTests/SWRevealViewControllerTests.swift new file mode 100644 index 0000000..768206a --- /dev/null +++ b/Tests/SWRevealViewControllerTests/SWRevealViewControllerTests.swift @@ -0,0 +1,11 @@ +import XCTest +@testable import SWRevealViewController + +final class SWRevealViewControllerTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(SWRevealViewController().text, "Hello, World!") + } +}