Skip to content

Commit f0b00e2

Browse files
committed
WIP
1 parent a8948bd commit f0b00e2

7 files changed

Lines changed: 60 additions & 36 deletions

File tree

Example/Example.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
383989BD1F564F5C003D30DD /* Random.swift in Sources */ = {isa = PBXBuildFile; fileRef = 383989BC1F564F5C003D30DD /* Random.swift */; };
1717
383B839D1F47897800027965 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 383B839C1F47897800027965 /* AppDelegate.swift */; };
1818
383B83A11F47897800027965 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 383B83A01F47897800027965 /* Assets.xcassets */; };
19+
3860DC1C2F96C27900F2D981 /* GlassInputBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3860DC1B2F96C27900F2D981 /* GlassInputBar.swift */; };
1920
388714E9202AC9620064C8BB /* InputBarStyleSelectionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 388714E8202AC9620064C8BB /* InputBarStyleSelectionController.swift */; };
2021
388714EB202AC9A50064C8BB /* SampleData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 388714EA202AC9A50064C8BB /* SampleData.swift */; };
2122
38C888C6202051B3000F2E2F /* ImageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38C888C5202051B3000F2E2F /* ImageCell.swift */; };
@@ -57,6 +58,7 @@
5758
383B839C1F47897800027965 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5859
383B83A01F47897800027965 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5960
383B83A51F47897800027965 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
61+
3860DC1B2F96C27900F2D981 /* GlassInputBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlassInputBar.swift; sourceTree = "<group>"; };
6062
388714E8202AC9620064C8BB /* InputBarStyleSelectionController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputBarStyleSelectionController.swift; sourceTree = "<group>"; };
6163
388714EA202AC9A50064C8BB /* SampleData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleData.swift; sourceTree = "<group>"; };
6264
38C888C5202051B3000F2E2F /* ImageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCell.swift; sourceTree = "<group>"; };
@@ -137,6 +139,7 @@
137139
3821ADE520F5360B00DE0D1D /* InputBarStyle.swift */,
138140
38F0C1FD20C89C9B00FF8DD3 /* iMessageInputBar.swift */,
139141
38F0C1FF20C89CA200FF8DD3 /* SlackInputBar.swift */,
142+
3860DC1B2F96C27900F2D981 /* GlassInputBar.swift */,
140143
38F0C20120C89CAB00FF8DD3 /* GitHawkInputBar.swift */,
141144
38F0C20320C89CB400FF8DD3 /* FacebookInputBar.swift */,
142145
38DAD87C21A685C6001762CD /* NoTextViewInputBar.swift */,
@@ -287,6 +290,7 @@
287290
3821ADE420F5359800DE0D1D /* CommonTableViewController.swift in Sources */,
288291
38F0C20820C89D1600FF8DD3 /* InboxCell.swift in Sources */,
289292
383B839D1F47897800027965 /* AppDelegate.swift in Sources */,
293+
3860DC1C2F96C27900F2D981 /* GlassInputBar.swift in Sources */,
290294
38FCF9D6219F797600A47350 /* READMEPreviewViewController.swift in Sources */,
291295
38C888C6202051B3000F2E2F /* ImageCell.swift in Sources */,
292296
38DAD87D21A685C6001762CD /* NoTextViewInputBar.swift in Sources */,

Example/Sources/Example ViewControllers/InputAccessoryExampleViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import InputBarAccessoryView
1212
class InputAccessoryExampleViewController: CommonTableViewController {
1313

1414
// MARK: - Properties
15-
15+
1616
override var inputAccessoryView: UIView? {
1717
return inputBar
1818
}
@@ -26,5 +26,5 @@ class InputAccessoryExampleViewController: CommonTableViewController {
2626
override func viewDidLoad() {
2727
super.viewDidLoad()
2828
}
29-
29+
3030
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// GlassInputBar.swift
3+
// Example
4+
//
5+
// Created by Nathan Tannar on 2026-04-20.
6+
// Copyright © 2026 Nathan Tannar. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import InputBarAccessoryView
11+
12+
final class GlassInputBar: InputBarAccessoryView {
13+
14+
override init(frame: CGRect) {
15+
super.init(frame: frame)
16+
configure()
17+
}
18+
19+
required init?(coder aDecoder: NSCoder) {
20+
fatalError("init(coder:) has not been implemented")
21+
}
22+
23+
private func configure() {
24+
backgroundColor = nil
25+
separatorLine.isHidden = true
26+
if #available(iOS 26.0, *) {
27+
backgroundView.effect = UIGlassContainerEffect()
28+
backgroundView.backgroundColor = nil
29+
30+
let effect = UIGlassEffect(style: .regular)
31+
effect.isInteractive = true
32+
contentView.cornerConfiguration = .capsule()
33+
contentView.effect = effect
34+
}
35+
36+
37+
}
38+
}
39+

Example/Sources/InputBar Examples/InputBarStyle.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ enum InputBarStyle: String, CaseIterable {
1515
case slack = "Slack"
1616
case githawk = "GitHawk"
1717
case facebook = "Facebook"
18+
case glass = "Glass"
1819
case noTextView = "No InputTextView"
1920
case `default` = "Default"
2021

@@ -24,6 +25,7 @@ enum InputBarStyle: String, CaseIterable {
2425
case .slack: return SlackInputBar()
2526
case .githawk: return GitHawkInputBar()
2627
case .facebook: return FacebookInputBar()
28+
case .glass: return GlassInputBar()
2729
case .noTextView: return NoTextViewInputBar()
2830
case .default: return InputBarAccessoryView()
2931
}

Example/Sources/InputBar Examples/iMessageInputBar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class iMessageInputBar: InputBarAccessoryView {
4343
sendButton.backgroundColor = .clear
4444
middleContentViewPadding.right = -38
4545
separatorLine.isHidden = true
46-
isTranslucent = true
46+
backgroundView.effect = UIBlurEffect(style: .systemMaterial)
4747
}
4848

4949
}

Sources/InputBarAccessoryView.swift

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ open class InputBarAccessoryView: UIView {
3737

3838
/// The background UIView anchored to the bottom, left, and right of the InputBarAccessoryView
3939
/// with a top anchor equal to the bottom of the top InputStackView
40-
open var backgroundView: UIView = {
41-
let view = UIView()
40+
open var backgroundView: UIVisualEffectView = {
41+
let view = UIVisualEffectView()
4242
view.translatesAutoresizingMaskIntoConstraints = false
4343
view.backgroundColor = InputBarAccessoryView.defaultBackgroundColor
4444
return view
@@ -47,41 +47,12 @@ open class InputBarAccessoryView: UIView {
4747
/// A content UIView that holds the left/right/bottom InputStackViews
4848
/// and the middleContentView. Anchored to the bottom of the
4949
/// topStackView and inset by the padding UIEdgeInsets
50-
open var contentView: UIView = {
51-
let view = UIView()
52-
view.translatesAutoresizingMaskIntoConstraints = false
53-
return view
54-
}()
55-
56-
/**
57-
A UIVisualEffectView that adds a blur effect to make the view appear transparent.
58-
59-
## Important Notes ##
60-
1. The blurView is initially not added to the backgroundView to improve performance when not needed. When `isTranslucent` is set to TRUE for the first time the blurView is added and anchored to the `backgroundView`s edge anchors
61-
*/
62-
open lazy var blurView: UIVisualEffectView = {
63-
var blurEffect = UIBlurEffect(style: .light)
64-
if #available(iOS 13, *) {
65-
blurEffect = UIBlurEffect(style: .systemMaterial)
66-
}
67-
let view = UIVisualEffectView(effect: blurEffect)
50+
open var contentView: UIVisualEffectView = {
51+
let view = UIVisualEffectView()
6852
view.translatesAutoresizingMaskIntoConstraints = false
6953
return view
7054
}()
7155

72-
/// Determines if the InputBarAccessoryView should have a translucent effect
73-
open var isTranslucent: Bool = false {
74-
didSet {
75-
if isTranslucent && blurView.superview == nil {
76-
backgroundView.addSubview(blurView)
77-
blurView.fillSuperview()
78-
}
79-
blurView.isHidden = !isTranslucent
80-
let color: UIColor = backgroundView.backgroundColor ?? InputBarAccessoryView.defaultBackgroundColor
81-
backgroundView.backgroundColor = isTranslucent ? color.withAlphaComponent(0.75) : color
82-
}
83-
}
84-
8556
/// A SeparatorLine that is anchored at the top of the InputBarAccessoryView
8657
public let separatorLine = SeparatorLine()
8758

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//
2+
// File.swift
3+
// InputBarAccessoryView
4+
//
5+
// Created by Nathan Tannar on 2026-04-20.
6+
//
7+
8+
import Foundation

0 commit comments

Comments
 (0)