This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from clappr/feature/core_layer
Create Core layer
- Loading branch information
Showing
8 changed files
with
140 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import UIKit | ||
|
||
final class CoreLayer: Layer { | ||
func attachPlugin(_ plugin: UICorePlugin) { | ||
addSubview(plugin.view) | ||
} | ||
|
||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { | ||
let result = super.hitTest(point, with: event) | ||
if result == self { return nil } | ||
return result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Tests/Clappr_Tests/Classes/Base/Layers/CoreLayerTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Quick | ||
import Nimble | ||
@testable import Clappr | ||
|
||
class CoreLayerTests: QuickSpec { | ||
override func spec() { | ||
describe(".CoreLayer") { | ||
context("When a UICorePlugin is attached") { | ||
it("is added as a CoreLayer subview") { | ||
let uiCorePlugin = UICorePluginStub(context: CoreStub()) | ||
let coreLayer = CoreLayer() | ||
|
||
coreLayer.attachPlugin(uiCorePlugin) | ||
|
||
expect(uiCorePlugin.view.superview).to(equal(coreLayer)) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@testable import Clappr | ||
|
||
class UICorePluginStub: UICorePlugin { | ||
var didCallRender = false | ||
|
||
override class var name: String { "UICorePluginStub" } | ||
override func bindEvents() { } | ||
|
||
override func render() { | ||
didCallRender = true | ||
} | ||
} |