Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swift Package Manager support #143

Merged
merged 1 commit into from
Jan 13, 2021
Merged
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
22 changes: 22 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// swift-tools-version:5.3

import PackageDescription

let package = Package(
name: "SwiftTweaks",
platforms: [.iOS(.v9)],
products: [.library(name: "SwiftTweaks", targets: ["SwiftTweaks"])],
targets: [
.target(
name: "SwiftTweaks",
path: "SwiftTweaks",
exclude: ["Info.plist", "SwiftTweaks.h"]
),
.testTarget(
name: "SwiftTweaksTests",
dependencies: ["SwiftTweaks"],
path: "SwiftTweaksTests",
exclude: ["Info.plist"]
)
]
)
8 changes: 3 additions & 5 deletions SwiftTweaks.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
939F2CE01CB81ED400345E03 /* TweakClusterType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 939F2CDF1CB81ED400345E03 /* TweakClusterType.swift */; };
93A3AF321BF1677B00CAD43B /* TweakWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A3AF311BF1677B00CAD43B /* TweakWindow.swift */; };
93A84EDC1BEAE86E0022D2F3 /* SwiftTweaks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93A84ED11BEAE86E0022D2F3 /* SwiftTweaks.framework */; };
93A84EE11BEAE86E0022D2F3 /* SwiftTweaksTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A84EE01BEAE86E0022D2F3 /* SwiftTweaksTests.swift */; };
93A84EF01BEAE88D0022D2F3 /* HashingUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A84EEB1BEAE88D0022D2F3 /* HashingUtilities.swift */; };
93A84EF11BEAE88D0022D2F3 /* HashingUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A84EEB1BEAE88D0022D2F3 /* HashingUtilities.swift */; };
93A84EF21BEAE88D0022D2F3 /* Tweak.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A84EEC1BEAE88D0022D2F3 /* Tweak.swift */; };
Expand Down Expand Up @@ -158,7 +157,6 @@
93A84ED41BEAE86E0022D2F3 /* SwiftTweaks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftTweaks.h; sourceTree = "<group>"; };
93A84ED61BEAE86E0022D2F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
93A84EDB1BEAE86E0022D2F3 /* SwiftTweaksTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftTweaksTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
93A84EE01BEAE86E0022D2F3 /* SwiftTweaksTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftTweaksTests.swift; sourceTree = "<group>"; };
93A84EE21BEAE86E0022D2F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
93A84EEB1BEAE88D0022D2F3 /* HashingUtilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HashingUtilities.swift; sourceTree = "<group>"; };
93A84EEC1BEAE88D0022D2F3 /* Tweak.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tweak.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -313,7 +311,6 @@
93A84EDF1BEAE86E0022D2F3 /* SwiftTweaksTests */ = {
isa = PBXGroup;
children = (
93A84EE01BEAE86E0022D2F3 /* SwiftTweaksTests.swift */,
931472481BFFB0C800F66D20 /* UIColor+TweaksTests.swift */,
939F2CCB1CB715E800345E03 /* Clipping+TweaksTest.swift */,
93478C7B1CBDF03A0064D8AD /* Precision+TweaksTests.swift */,
Expand Down Expand Up @@ -432,7 +429,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1230;
ORGANIZATIONNAME = "Khan Academy";
TargetAttributes = {
93A84ED01BEAE86E0022D2F3 = {
Expand Down Expand Up @@ -544,7 +541,6 @@
files = (
93B058E51CC53AD100AB2759 /* Precision.swift in Sources */,
931472521BFFB41700F66D20 /* ColorRepresentation.swift in Sources */,
93A84EE11BEAE86E0022D2F3 /* SwiftTweaksTests.swift in Sources */,
930ECDB81DA6EEB9001009B3 /* TweakViewData+TweaksTests.swift in Sources */,
93B058D71CBDF58500AB2759 /* TweakClusterType.swift in Sources */,
AA356AF51EB3C5FC0063F4E2 /* TweakAction.swift in Sources */,
Expand Down Expand Up @@ -618,6 +614,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -676,6 +673,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down
3 changes: 1 addition & 2 deletions SwiftTweaks/TweakWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ import UIKit

self.tweakStore = tweakStore

// Are we running on a Mac? If so, then we're in a simulator!
#if (arch(i386) || arch(x86_64))
#if targetEnvironment(simulator)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in Swift 4.1

self.runningInSimulator = true
#else
self.runningInSimulator = false
Expand Down
2 changes: 1 addition & 1 deletion SwiftTweaks/TweakableType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public enum TweakDefaultData {

public struct StringOption {
public let value: String
init(value: String) {
public init(value: String) {
self.value = value
}
}
Expand Down
4 changes: 4 additions & 0 deletions SwiftTweaks/UIImage+SwiftTweaks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ internal extension UIImage {
// NOTE (bryan): if we just used UIImage(named:_), we get crashes when running in other apps!
// (Why? Because by default, iOS searches in your app's bundle, but we need to redirect that to the bundle associated with SwiftTweaks
private convenience init?(inThisBundleNamed imageName: String) {
#if SWIFT_PACKAGE
self.init(named: imageName, in: Bundle.module, compatibleWith: nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#else
self.init(named: imageName, in: Bundle(for: TweakTableCell.self), compatibleWith: nil) // NOTE (bryan): Could've used any class in SwiftTweaks here.
#endif
}

/// Returns the image, tinted to the given color.
Expand Down
1 change: 1 addition & 0 deletions SwiftTweaksTests/Clipping+TweaksTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import XCTest
@testable import SwiftTweaks

private struct ClippingTestCase<T> where T: SignedNumeric, T: Comparable {
let inputValue: T
Expand Down
1 change: 1 addition & 0 deletions SwiftTweaksTests/Precision+TweaksTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import XCTest
@testable import SwiftTweaks

private struct PrecisionTestCase<T: Roundable> {
let inputValue: T
Expand Down
12 changes: 0 additions & 12 deletions SwiftTweaksTests/SwiftTweaksTests.swift

This file was deleted.

1 change: 1 addition & 0 deletions SwiftTweaksTests/TweakViewData+TweaksTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import XCTest
@testable import SwiftTweaks

class TweakViewData_TweaksTests: XCTestCase {

Expand Down