Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
begin of refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Baumbach committed Mar 1, 2018
1 parent 4e37e16 commit 88eaa11
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Example/Tests/Tests.swift
Expand Up @@ -17,7 +17,7 @@ class Tests: XCTestCase {
func testDefaultRealmBrowser() {
// This is an example of a functional test case.
guard RBSRealmBrowser.realmBrowser() != nil else {
XCTAssert(true, "Fail init")
XCTAssert(false, "Fail init")
return
}
XCTAssert(true, "Pass")
Expand Down
28 changes: 28 additions & 0 deletions Package.swift
@@ -0,0 +1,28 @@
// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "RBSRealmBrowser",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "RBSRealmBrowser",
targets: ["RBSRealmBrowser"]),
],
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: "RBSRealmBrowser",
dependencies: []),
.testTarget(
name: "RBSRealmBrowserTests",
dependencies: ["RBSRealmBrowser"]),
]
)
32 changes: 18 additions & 14 deletions Pod/Classes/RBSRealmPropertyCell.swift
Expand Up @@ -11,32 +11,36 @@ import RealmSwift

class RBSRealmPropertyCell: UITableViewCell, UITextFieldDelegate {
private var labelPropertyTitle = UILabel()
private var textFieldPropValue = UITextField()
private var labelPropertyType = UILabel()
private var textFieldPropValue:UITextField = {
let textField = UITextField()
let spacing = UIView(frame:CGRect(x:0.0, y:0.0, width:10.0, height:0.0))
textField.leftViewMode = .always
textField.leftView = spacing
textField.rightViewMode = .always
textField.rightView = spacing
textField.returnKeyType = .done
textField.backgroundColor = .white
textField.textAlignment = .right
return textField
}()
private var labelPropertyType:UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 12.0)
label.textColor = .lightGray
return label
}()
private var property: Property! = nil
weak var delegate: RBSRealmPropertyCellDelegate?

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none

textFieldPropValue.returnKeyType = .done
textFieldPropValue.backgroundColor = .white
textFieldPropValue.textAlignment = .right

let spacing = UIView(frame:CGRect(x:0.0, y:0.0, width:10.0, height:0.0))
textFieldPropValue.leftViewMode = .always
textFieldPropValue.leftView = spacing
textFieldPropValue.rightViewMode = .always
textFieldPropValue.rightView = spacing
UITextField.appearance().tintColor = UIColor(red:0.35, green:0.34, blue:0.62, alpha:1.0)
contentView.addSubview(self.textFieldPropValue)

labelPropertyTitle = labelWithAttributes(14, weight:0.3, text: "")
contentView.addSubview(self.labelPropertyTitle)

labelPropertyType.font = UIFont.systemFont(ofSize: 12.0)
labelPropertyType.textColor = .lightGray
contentView.addSubview(labelPropertyType)
}

Expand Down
6 changes: 6 additions & 0 deletions Tests/LinuxMain.swift
@@ -0,0 +1,6 @@
import XCTest
@testable import RBSRealmBrowserTests

XCTMain([
testCase(RBSRealmBrowserTests.allTests),
])
16 changes: 16 additions & 0 deletions Tests/RBSRealmBrowserTests/RBSRealmBrowserTests.swift
@@ -0,0 +1,16 @@
import XCTest
@testable import RBSRealmBrowser

class RBSRealmBrowserTests: 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(RBSRealmBrowser().text, "Hello, World!")
}


static var allTests = [
("testExample", testExample),
]
}

0 comments on commit 88eaa11

Please sign in to comment.