Skip to content

Commit

Permalink
Merge branch 'main' into feat-swiftui-hint
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinneko committed Oct 9, 2024
2 parents 6333a45 + a24e6ad commit f535373
Show file tree
Hide file tree
Showing 67 changed files with 1,534 additions and 440 deletions.
14 changes: 7 additions & 7 deletions BuildTools/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,20 @@
},
{
"package": "swift-syntax",
"repositoryURL": "https://github.com/apple/swift-syntax.git",
"repositoryURL": "https://github.com/swiftlang/swift-syntax.git",
"state": {
"branch": null,
"revision": "303e5c5c36d6a558407d364878df131c3546fad8",
"version": "510.0.2"
"revision": "515f79b522918f83483068d99c68daeb5116342d",
"version": "600.0.0-prerelease-2024-08-14"
}
},
{
"package": "SwiftFormat",
"repositoryURL": "https://github.com/nicklockwood/SwiftFormat",
"state": {
"branch": null,
"revision": "4bf475154c1c98dcdf751037f930f8e5c72597a4",
"version": "0.53.10"
"revision": "ab6844edb79a7b88dc6320e6cee0a0db7674dac3",
"version": "0.54.5"
}
},
{
Expand All @@ -141,8 +141,8 @@
"repositoryURL": "https://github.com/realm/SwiftLint",
"state": {
"branch": null,
"revision": "b515723b16eba33f15c4677ee65f3fef2ce8c255",
"version": "0.55.1"
"revision": "168fb98ed1f3e343d703ecceaf518b6cf565207b",
"version": "0.57.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public struct BalloonsView: View {
)
}
}
.navigationBarTitle("Tooltips")
.navigationBarTitle("Balloons")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public struct ContentView: View {
NavigationLink(destination: SpinnersView()) {
Text("Spinners")
}
NavigationLink(destination: BalloonsView().charcoalOverlayContainer()) {
Text("Balloons")
}
}
.navigationBarTitle("Charcoal")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "スクリーンショット 2024-02-21 17.28.10.png",
"filename" : "charcoal-logo.png",
"idiom" : "universal"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public struct ToastsView: View {
}
.charcoalSnackBar(
isPresenting: $isPresenting,
text: "ブックマークしました"
text: "ブックマークしました",
dismissAfter: 4
)

VStack(alignment: .leading) {
Expand All @@ -37,6 +38,7 @@ public struct ToastsView: View {
isPresenting: $isPresenting2,
screenEdge: .top,
text: "ブックマークしました",
dismissAfter: 4,
action: {
Button {
print("Tapped")
Expand All @@ -58,6 +60,7 @@ public struct ToastsView: View {
isPresenting: $isPresenting3,
text: "ブックマークしました",
thumbnailImage: Image("SnackbarDemo", bundle: Bundle.module),
dismissAfter: 4,
action: {
Button {
print("Tapped")
Expand All @@ -73,13 +76,13 @@ public struct ToastsView: View {
} label: {
Text("SnackBar")
}
Text("Auto dismiss after 2 seconds")
Text("Auto dismiss after 4 seconds")
}
.charcoalSnackBar(
isPresenting: $isPresenting4,
text: "ブックマークしました",
thumbnailImage: Image("SnackbarDemo", bundle: Bundle.module),
dismissAfter: 2,
dismissAfter: 4,
action: {
Button {
print("Tapped")
Expand All @@ -98,7 +101,8 @@ public struct ToastsView: View {
}
.charcoalToast(
isPresenting: $isPresentingToast,
text: "テキストメッセージ"
text: "テキストメッセージ",
dismissAfter: 4
)

VStack(alignment: .leading) {
Expand All @@ -113,6 +117,7 @@ public struct ToastsView: View {
isPresenting: $isPresentingToast2,
screenEdge: .top,
text: "テキストメッセージ",
dismissAfter: 4,
action: {
Button {
isPresentingToast2 = false
Expand All @@ -134,6 +139,7 @@ public struct ToastsView: View {
.charcoalToast(
isPresenting: $isPresentingToast3,
text: "ブックマークしました",
dismissAfter: 4,
appearance: .error,
animationConfiguration: CharcoalToastAnimationConfiguration(enablePositionAnimation: false, animation: .easeInOut),
action: {
Expand All @@ -152,12 +158,12 @@ public struct ToastsView: View {
} label: {
Text("Toast(Error Appearance)")
}
Text("Auto dismiss after 2 seconds")
Text("Auto dismiss after 4 seconds")
}
.charcoalToast(
isPresenting: $isPresentingToast4,
text: "ブックマークしました",
dismissAfter: 2,
dismissAfter: 4,
appearance: .error
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public struct TooltipsView: View {
}).charcoalTooltip(isPresenting: $isPresented3, text: "Tooltip created by Charcoal and here is testing Auto-Positioning")
}
}
.charcoalOverlayContainer()
.navigationBarTitle("Tooltips")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public final class ContentViewController: UIViewController {
case tooltips = "Tooltips"
case toasts = "Toasts"
case spinners = "Spinners"
case balloons = "Balloons"

var viewController: UIViewController {
switch self {
Expand All @@ -73,6 +74,8 @@ public final class ContentViewController: UIViewController {
return ToastsViewController()
case .spinners:
return SpinnersViewController()
case .balloons:
return BalloonsViewController()
}
}
}
Expand Down Expand Up @@ -179,7 +182,7 @@ extension ContentViewController {
private func performActionFor(setting: SettingsTitles, sender: UISwitch) {
switch setting {
case .darkMode:
navigationController?.overrideUserInterfaceStyle = sender.isOn ? .dark : .light
navigationController?.topViewController?.view.window?.overrideUserInterfaceStyle = sender.isOn ? .dark : .light
case .fixedSizeCategory:
CharcoalConfig.configUIKit.fixedSizeCategory = sender.isOn ? .large : nil

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "スクリーンショット 2024-02-21 17.28.10.png",
"filename" : "charcoal-logo.png",
"idiom" : "universal"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import UIKit

class BalloonTableViewCell: UITableViewCell {
static let identifier = "TooltipCell"

let titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 16, weight: .medium)
label.textColor = UIColor.black
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

let leadingImageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView
}()

let accessoryImageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView
}()

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

contentView.addSubview(titleLabel)
contentView.addSubview(leadingImageView)
contentView.addSubview(accessoryImageView)

NSLayoutConstraint.activate([
leadingImageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 10),
leadingImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor)
])

NSLayoutConstraint.activate([
titleLabel.leadingAnchor.constraint(equalTo: leadingImageView.trailingAnchor, constant: 10),
titleLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor)
])

NSLayoutConstraint.activate([
accessoryImageView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -10),
accessoryImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor)
])
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func layoutSubviews() {
super.layoutSubviews()
}

override func prepareForReuse() {
super.prepareForReuse()
titleLabel.text = nil
leadingImageView.image = nil
}
}
Loading

0 comments on commit f535373

Please sign in to comment.