summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/MullvadVPN.xcodeproj/project.pbxproj4
-rw-r--r--ios/MullvadVPN/EmbeddedViewContainerView.swift60
2 files changed, 64 insertions, 0 deletions
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj
index ea382d9c6d..604eb78c2d 100644
--- a/ios/MullvadVPN.xcodeproj/project.pbxproj
+++ b/ios/MullvadVPN.xcodeproj/project.pbxproj
@@ -39,6 +39,7 @@
586BD68322B7BBD800BB7F9F /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 586BD68222B7BBD800BB7F9F /* NetworkExtension.framework */; };
586BD68422B7BBE400BB7F9F /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 586BD68222B7BBD800BB7F9F /* NetworkExtension.framework */; };
58723E7522A54CB2009837F5 /* libwg-go.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58723E7422A54C63009837F5 /* libwg-go.a */; };
+ 5873884D239E6D7E00E96C4E /* EmbeddedViewContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5873884C239E6D7E00E96C4E /* EmbeddedViewContainerView.swift */; };
587425C12299833500CA2045 /* RootContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587425C02299833500CA2045 /* RootContainerViewController.swift */; };
58781CC922AE7CA8009B9D8E /* RelayConstraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58781CC822AE7CA8009B9D8E /* RelayConstraints.swift */; };
58781CCE22AE8918009B9D8E /* RelayConstraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58781CC822AE7CA8009B9D8E /* RelayConstraints.swift */; };
@@ -167,6 +168,7 @@
5867A51B2248F26A005513C0 /* SegueIdentifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegueIdentifier.swift; sourceTree = "<group>"; };
586BD68222B7BBD800BB7F9F /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; };
58723E7422A54C63009837F5 /* libwg-go.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libwg-go.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 5873884C239E6D7E00E96C4E /* EmbeddedViewContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmbeddedViewContainerView.swift; sourceTree = "<group>"; };
587425C02299833500CA2045 /* RootContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootContainerViewController.swift; sourceTree = "<group>"; };
58781CC822AE7CA8009B9D8E /* RelayConstraints.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayConstraints.swift; sourceTree = "<group>"; };
58781CD422AFBA39009B9D8E /* RelaySelector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelaySelector.swift; sourceTree = "<group>"; };
@@ -310,6 +312,7 @@
5894FC482296A8090017471D /* CustomButton.swift */,
582BB1B0229569620055B6EF /* CustomNavigationBar.swift */,
58C6B35D22BBBFE3003C19AD /* Data+HexCoding.swift */,
+ 5873884C239E6D7E00E96C4E /* EmbeddedViewContainerView.swift */,
58CE5E6F224146210008646E /* Info.plist */,
5840250022B1124600E4CFEC /* IpAddress+Codable.swift */,
58C6B34E22BB7AC0003C19AD /* IPAddressRange.swift */,
@@ -629,6 +632,7 @@
587B08E0229433EB000E6F17 /* LoginState.swift in Sources */,
58C6B34F22BB7AC0003C19AD /* IPAddressRange.swift in Sources */,
582BB1AF229566420055B6EF /* SettingsCell.swift in Sources */,
+ 5873884D239E6D7E00E96C4E /* EmbeddedViewContainerView.swift in Sources */,
582650862384116F00FA7A86 /* ReplaceNilWithError.swift in Sources */,
5862805422428EF100F5A6E1 /* TranslucentButtonBlurView.swift in Sources */,
5888AD83227B11080051EB06 /* SelectLocationCell.swift in Sources */,
diff --git a/ios/MullvadVPN/EmbeddedViewContainerView.swift b/ios/MullvadVPN/EmbeddedViewContainerView.swift
new file mode 100644
index 0000000000..e2a6a3717f
--- /dev/null
+++ b/ios/MullvadVPN/EmbeddedViewContainerView.swift
@@ -0,0 +1,60 @@
+//
+// EmbeddedViewContainerView.swift
+// MullvadVPN
+//
+// Created by pronebird on 09/12/2019.
+// Copyright © 2019 Amagicom AB. All rights reserved.
+//
+
+import Foundation
+import UIKit
+
+/// A `UIView` subclass that implements a host view for an embedded subview via an outlet.
+@IBDesignable class EmbeddedViewContainerView: UIView {
+ @IBOutlet var embeddedView: UIView!
+
+ override func awakeFromNib() {
+ super.awakeFromNib()
+
+ backgroundColor = .clear
+
+ embeddedView.translatesAutoresizingMaskIntoConstraints = false
+
+ addSubview(embeddedView)
+
+ NSLayoutConstraint.activate([
+ embeddedView.topAnchor.constraint(equalTo: topAnchor),
+ embeddedView.leadingAnchor.constraint(equalTo: leadingAnchor),
+ embeddedView.trailingAnchor.constraint(equalTo: trailingAnchor),
+ embeddedView.bottomAnchor.constraint(equalTo: bottomAnchor)
+ ])
+ }
+
+ #if TARGET_INTERFACE_BUILDER
+ override func draw(_ rect: CGRect) {
+ UIColor.white.withAlphaComponent(0.3).setFill()
+ UIColor.white.withAlphaComponent(0.6).setStroke()
+
+ let bezierPath = UIBezierPath(rect: rect)
+ bezierPath.lineWidth = 1
+ bezierPath.fill()
+ bezierPath.stroke()
+
+ let attributedString = NSAttributedString(
+ string: "UIView",
+ attributes: [.foregroundColor: UIColor.white]
+ )
+
+ let textSize = attributedString.size()
+
+ var textRect = rect
+ textRect.origin.x = (rect.width - textSize.width) * 0.5
+ textRect.origin.y = (rect.height - textSize.height) * 0.5
+ textRect.size = textSize
+
+ attributedString.draw(in: textRect)
+ }
+ #endif
+
+
+}