Skip to content

Commit

Permalink
🔀 Merge pull request #12 from MrKai77/swiftformat
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKai77 authored Oct 7, 2024
2 parents 495b0eb + 5b5c329 commit 2f0c901
Show file tree
Hide file tree
Showing 15 changed files with 207 additions and 251 deletions.
76 changes: 76 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Bug Report
description: File a bug report.
title: "🐞 [Title here]"
labels: ["Bug"]
body:
- type: textarea
attributes:
label: Bug Description
description: Provide a clear and concise description of this bug.
validations:
required: true

- type: textarea
attributes:
label: Steps To Reproduce
description: Provide steps to reproduce this bug.
placeholder: |
1. [First Step]
2. [Second Step]
3. [and so on...]
validations:
required: true

- type: textarea
attributes:
label: Expected Behavior
description: Provide a clear and concise description of what you expected to happen.
validations:
required: true

- type: textarea
attributes:
label: Actual Behavior
description: Provide a clear and concise description of what happened.
validations:
required: true

- type: textarea
attributes:
label: Screenshots
description: Add screenshots to help explain this bug, if applicable.
validations:
required: false

- type: input
attributes:
label: macOS Version
description: Apple Logo -> About This Mac
placeholder: |
[ex. Ventura 13.1]
validations:
required: true

- type: textarea
attributes:
label: Additional Context
description: Provide any additional information about this bug.
validations:
required: false

- type: checkboxes
attributes:
label: Final Checks
options:
- label: My issue is written in English
required: true
- label: My issue title is descriptive
required: true
- label: This is a single bug (multiple bugs should be reported individually)
required: true
- label: I can help with fixing or developing this issue (tick if you can help).
required: false

- type: markdown
attributes:
value: Thank you for taking the time to report this bug!
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint

on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/swiftformat.yml'
- '.swiftformat.yml'
- '**/*.swift'

jobs:
Lint:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: SwiftFormat
run: swiftformat --lint . --reporter github-actions-log
87 changes: 87 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
--acronyms ID,URL,UUID
--allman false
--anonymousforeach convert
--assetliterals visual-width
--asynccapturing
--beforemarks
--binarygrouping 4,8
--categorymark "MARK: %c"
--classthreshold 0
--closingparen balanced
--closurevoid remove
--commas inline
--conflictmarkers reject
--decimalgrouping 3,6
--doccomments before-declarations
--elseposition same-line
--emptybraces no-space
--enumnamespaces always
--enumthreshold 0
--exponentcase lowercase
--exponentgrouping disabled
--extensionacl on-extension
--extensionlength 0
--extensionmark "MARK: - %t + %c"
--fractiongrouping disabled
--fragment false
--funcattributes preserve
--generictypes
--groupedextension "MARK: %c"
--guardelse auto
--header ignore
--hexgrouping 4,8
--hexliteralcase uppercase
--ifdef indent
--importgrouping alpha
--indent 4
--indentcase false
--indentstrings false
--lifecycle
--lineaftermarks true
--linebreaks lf
--markcategories true
--markextensions always
--marktypes always
--maxwidth none
--modifierorder
--nevertrailing
--nospaceoperators ...
--nowrapoperators
--octalgrouping 4,8
--onelineforeach ignore
--operatorfunc spaced
--organizetypes actor,class,enum,struct
--patternlet hoist
--ranges spaced
--redundanttype infer-locals-only
--self init-only
--selfrequired
--semicolons inline
--shortoptionals except-properties
--smarttabs enabled
--someany true
--stripunusedargs always
--structthreshold 0
--swiftversion 6.0
--tabwidth unspecified
--throwcapturing
--trailingclosures
--trimwhitespace always
--typeattributes preserve
--typeblanklines remove
--typemark "MARK: - %t"
--varattributes preserve
--voidtype tuple
--wraparguments preserve
--wrapcollections preserve
--wrapconditions preserve
--wrapeffects preserve
--wrapenumcases always
--wrapparameters default
--wrapreturntype preserve
--wrapternary default
--wraptypealiases preserve
--xcodeindentation disabled
--yodaswap always
--disable wrapMultilineStatementBraces
--enable isEmpty
9 changes: 4 additions & 5 deletions Sources/Luminare/Components/Popover/PopoverHolder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public struct PopoverHolder<Content: View>: NSViewRepresentable {
self.content = content
}

public func makeNSView(context: Context) -> NSView {
public func makeNSView(context _: Context) -> NSView {
.init()
}

Expand All @@ -26,7 +26,6 @@ public struct PopoverHolder<Content: View>: NSViewRepresentable {
}
}


public func makeCoordinator() -> Coordinator {
Coordinator(self, content: content)
}
Expand All @@ -49,7 +48,7 @@ public struct PopoverHolder<Content: View>: NSViewRepresentable {
func setVisible(_ isPresented: Bool, in view: NSView? = nil) {
// If we're going to be closing the window
guard isPresented else {
self.popover?.resignKey()
popover?.resignKey()
return
}

Expand Down Expand Up @@ -92,7 +91,7 @@ public struct PopoverHolder<Content: View>: NSViewRepresentable {
}
}

public func windowWillClose(_ notification: Notification) {
public func windowWillClose(_: Notification) {
Task {
await MainActor.run {
removeMonitor()
Expand All @@ -104,7 +103,7 @@ public struct PopoverHolder<Content: View>: NSViewRepresentable {

func initializePopup() {
self.popover = .init()
guard let popover = self.popover else { return }
guard let popover else { return }

popover.delegate = self
popover.contentViewController = NSHostingController(
Expand Down
13 changes: 6 additions & 7 deletions Sources/Luminare/Components/Popover/PopoverPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
// Created by Kai Azim on 2024-08-25.
//


import SwiftUI

public class PopoverPanel: NSPanel, ObservableObject {
public static let cornerRadius: CGFloat = 12
public static let contentPadding: CGFloat = 6
public static let sectionPadding: CGFloat = 8

@Published public var closeHandler: (() -> Void)?
@Published public var closeHandler: (() -> ())?

public init() {
super.init(
Expand All @@ -32,24 +31,24 @@ public class PopoverPanel: NSPanel, ObservableObject {
level = .floating
}

public override var canBecomeKey: Bool {
override public var canBecomeKey: Bool {
true
}

public override var canBecomeMain: Bool {
override public var canBecomeMain: Bool {
false
}

public override var acceptsFirstResponder: Bool {
override public var acceptsFirstResponder: Bool {
true
}

public override func close() {
override public func close() {
closeHandler?()
super.close()
}

public override func resignKey() {
override public func resignKey() {
close()
}
}
8 changes: 4 additions & 4 deletions Sources/Luminare/Main Window/Luminare.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import SwiftUI

public struct LuminareConstants {
public enum LuminareConstants {
public static var tint: () -> Color = { .accentColor }
public static var animation: Animation = .smooth(duration: 0.2)
public static var fastAnimation: Animation = .easeOut(duration: 0.1)
Expand All @@ -16,10 +16,10 @@ public struct LuminareConstants {
public class LuminareWindow: NSWindow {
private var initializationTime: Date

public init<Content>(
public init(
blurRadius: CGFloat? = nil,
content: @escaping () -> Content
) where Content: View {
content: @escaping () -> some View
) {
self.initializationTime = .now

super.init(
Expand Down
3 changes: 1 addition & 2 deletions Sources/Luminare/Main Window/LuminareDividedStack.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
//
// DividedHStack.swift
// LuminareDividedStack.swift
// Luminare
//
// Created by Kai Azim on 2024-09-29.
//


import SwiftUI

public struct LuminareDividedStack<Content: View>: View {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Luminare/Main Window/LuminarePane.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public struct LuminarePane<V, C>: View where V: View, C: View {
let header: () -> C
let content: () -> V

@State private var clickedOutsideFlag: Bool = false
@State private var clickedOutsideFlag = false

public init(
@ViewBuilder header: @escaping () -> C,
Expand Down
10 changes: 6 additions & 4 deletions Sources/Luminare/Main Window/LuminareView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct LuminareView<Content>: View where Content: View {
GeometryReader { proxy in
Color.clear
.onAppear(perform: { print(proxy.size.height); setSize(size: proxy.size, animate: false) })
.onChange(of: proxy.size, perform: { setSize(size: $0, animate: true) })
.onChange(of: proxy.size, perform: { setSize(size: $0, animate: true) })
}
}
.frame(minWidth: 100, maxWidth: .infinity, minHeight: 100, maxHeight: .infinity, alignment: .leading)
Expand Down Expand Up @@ -72,6 +72,7 @@ struct LuminareView<Content>: View where Content: View {
}

// MARK: - NSWindow Animation

// Custom NSWindow resize animation so that it can be stopped midway

class LuminareWindowAnimation: NSAnimation {
Expand All @@ -84,11 +85,12 @@ class LuminareWindowAnimation: NSAnimation {
super.init(duration: 0.5, animationCurve: .easeOut)
super.animationBlockingMode = .nonblocking // Allows the window to redraw contents while animating
}

required init?(coder: NSCoder) {

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

override var currentProgress: NSAnimation.Progress {
didSet {
// The last frame of this NSAnimation looks a little stuttery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct LuminareSidebarSection<Tab>: View where Tab: LuminareTabItem, Tab:
}

@ViewBuilder func sectionTitle() -> some View {
if let title = title {
if let title {
HStack {
Text(title)
.opacity(0.7)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct LuminareSidebarTab<Tab>: View where Tab: LuminareTabItem {
@Binding var activeTab: Tab
let tab: Tab

@State private var isActive: Bool = false
@State private var isActive = false

public init(_ tab: Tab, _ activeTab: Binding<Tab>) {
self._activeTab = activeTab
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// LuminareTrafficLightedWindowView.swift
//
//
//
// Created by Kai Azim on 2024-06-15.
//
Expand Down
Loading

0 comments on commit 2f0c901

Please sign in to comment.