Skip to content

Commit

Permalink
Resolve code review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Kormakov committed Oct 18, 2019
1 parent a28b415 commit 69278a1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
13 changes: 12 additions & 1 deletion Example/FramezillaExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ViewController: UIViewController {

view.backgroundColor = .white

container.backgroundColor = .yellow
container.backgroundColor = .cyan

content1.backgroundColor = .red
content2.backgroundColor = .black
Expand All @@ -49,6 +49,8 @@ class ViewController: UIViewController {
label3.text = "Helloe"

textField1.placeholder = "Type Something"
textField1.delegate = self
textField1.backgroundColor = .white

view.addSubview(container)
view.listenForKeyboardEvents()
Expand Down Expand Up @@ -97,3 +99,12 @@ class ViewController: UIViewController {
}
}

// MARK: - UITextFieldDelegate

extension ViewController: UITextFieldDelegate {

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return false
}
}
8 changes: 4 additions & 4 deletions Framezilla.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
11FB41481D844F8F00700A40 /* UIView+Installer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11FB41431D844F8F00700A40 /* UIView+Installer.swift */; };
11FB41491D844F8F00700A40 /* UIView+Relations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11FB41441D844F8F00700A40 /* UIView+Relations.swift */; };
2E083838230D2434007D0928 /* Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E083837230D2434007D0928 /* Keyboard.swift */; };
2E08383A230D244F007D0928 /* KeyboardCloneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E083839230D244F007D0928 /* KeyboardCloneView.swift */; };
2E08383A230D244F007D0928 /* KeyboardRectCloneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E083839230D244F007D0928 /* KeyboardRectCloneView.swift */; };
2E08383C230D245F007D0928 /* Weak.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E08383B230D245F007D0928 /* Weak.swift */; };
2E08383E230D2482007D0928 /* UIView+Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E08383D230D2482007D0928 /* UIView+Keyboard.swift */; };
2E79EEC6231CE45C00A6C548 /* Relations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E79EEC5231CE45C00A6C548 /* Relations.swift */; };
Expand Down Expand Up @@ -62,7 +62,7 @@
11FB414B1D844FFA00700A40 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
11FB414C1D844FFA00700A40 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
2E083837230D2434007D0928 /* Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keyboard.swift; sourceTree = "<group>"; };
2E083839230D244F007D0928 /* KeyboardCloneView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardCloneView.swift; sourceTree = "<group>"; };
2E083839230D244F007D0928 /* KeyboardRectCloneView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardRectCloneView.swift; sourceTree = "<group>"; };
2E08383B230D245F007D0928 /* Weak.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Weak.swift; sourceTree = "<group>"; };
2E08383D230D2482007D0928 /* UIView+Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Keyboard.swift"; sourceTree = "<group>"; };
2E79EEC5231CE45C00A6C548 /* Relations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Relations.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -133,7 +133,7 @@
2E083840230D24DF007D0928 /* Supporting */,
2E08383F230D249B007D0928 /* Extensions */,
2E083837230D2434007D0928 /* Keyboard.swift */,
2E083839230D244F007D0928 /* KeyboardCloneView.swift */,
2E083839230D244F007D0928 /* KeyboardRectCloneView.swift */,
11FB41401D844F8F00700A40 /* Maker.swift */,
11FB41421D844F8F00700A40 /* MakerHelper.swift */,
8497C0101E59EB7700447E2F /* Number.swift */,
Expand Down Expand Up @@ -363,7 +363,7 @@
844BE8F320457634004C19A8 /* Maker+Unavailable.swift in Sources */,
11FB41491D844F8F00700A40 /* UIView+Relations.swift in Sources */,
842BB7FC1F0638E9000D1CFF /* Parameters.swift in Sources */,
2E08383A230D244F007D0928 /* KeyboardCloneView.swift in Sources */,
2E08383A230D244F007D0928 /* KeyboardRectCloneView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion Sources/Keyboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Keyboard: EdgeRelationCollection {
return false
}

return KeyboardRectCloneView.shared.frame.minY != window.frame.maxY
return KeyboardRectCloneView.shared.frame.intersects(window.frame)
}

init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class KeyboardRectCloneView: UIView {
isUserInteractionEnabled = false

NotificationCenter.default.addObserver(self,
selector: #selector(keyboardFrameChanged(_:)),
selector: #selector(keyboardFrameChanged),
name: UIApplication.keyboardWillChangeFrameNotification,
object: nil)
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/KeyboardTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import XCTest
import Framezilla

class DummyView: UIView {
final class DummyView: UIView {
var layoutHandler: (() -> Void)?

override func layoutSubviews() {
Expand All @@ -14,7 +14,7 @@ class DummyView: UIView {
}
}

class KeyboardTests: BaseTest {
final class KeyboardTests: BaseTest {

private func postKeyboardNotification(rect: CGRect) {
NotificationCenter.default.post(name: UIApplication.keyboardWillChangeFrameNotification,
Expand Down

0 comments on commit 69278a1

Please sign in to comment.