Skip to content
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
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SDStateTableView",
platforms: [
.iOS(.v10),
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "SDStateTableView",
targets: ["SDStateTableView"]),
],
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: "SDStateTableView",
dependencies: []),
.testTarget(
name: "SDStateTableViewTests",
dependencies: ["SDStateTableView"]),
]
)
6 changes: 5 additions & 1 deletion SDStateTableView/Classes/SDStateTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public class SDStateTableView: UITableView {
// Deinitialization code goes here
}

@available(iOS 10.0, *)
public func setState(_ state: SDStateTableViewState) {
self.currentState = state

Expand Down Expand Up @@ -293,6 +294,7 @@ public class SDStateTableView: UITableView {
dataStateSubtitleLabel.text = message
}

@available(iOS 10.0, *)
private func configureWith(image: UIImage?, title: String?, message: String) {

// Image View
Expand Down Expand Up @@ -325,6 +327,7 @@ public class SDStateTableView: UITableView {
dataStateSubtitleLabel.text = message
}

@available(iOS 10.0, *)
private func configWithButton(image: UIImage?, title: String?, message: String,
buttonTitle: String,
buttonConfig: (UIButton) ->Void,
Expand All @@ -343,7 +346,8 @@ public class SDStateTableView: UITableView {

fileprivate extension UIImage {
// Redraws itself to the new size
func imageWith(newSize: CGSize) -> UIImage {
@available(iOS 10.0, *)
func imageWith(newSize: CGSize) -> UIImage {
let renderer = UIGraphicsImageRenderer(size: newSize)
let image = renderer.image { _ in
self.draw(in: CGRect.init(origin: CGPoint.zero, size: newSize))
Expand Down
3 changes: 3 additions & 0 deletions Sources/SDStateTableView/SDStateTableView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct SDStateTableView {
var text = "Hello, World!"
}
7 changes: 7 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest

import SDStateTableViewTests

var tests = [XCTestCaseEntry]()
tests += SDStateTableViewTests.allTests()
XCTMain(tests)
15 changes: 15 additions & 0 deletions Tests/SDStateTableViewTests/SDStateTableViewTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import XCTest
@testable import SDStateTableView

final class SDStateTableViewTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
XCTAssertEqual(SDStateTableView().text, "Hello, World!")
}

static var allTests = [
("testExample", testExample),
]
}
9 changes: 9 additions & 0 deletions Tests/SDStateTableViewTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(SDStateTableViewTests.allTests),
]
}
#endif