Fix code style
All checks were successful
SwiftLint / SwiftLint (pull_request) Successful in 6s

This commit is contained in:
david-swift 2025-08-26 13:33:43 +02:00
parent 0af3864058
commit 87b970d844
3 changed files with 55 additions and 24 deletions

View File

@ -1,22 +1,43 @@
//
// WrapMode.swift
// Adwaita
//
// Created by mlm on 24.08.25.
//
import CAdw import CAdw
/// Wrap modes for `TextView`/`TextEditor` /// Wrap modes for `TextView`/`TextEditor`
public enum WrapMode: GtkWrapMode, RawRepresentable { public enum WrapMode: GtkWrapMode, RawRepresentable {
case none // GTK_WRAP_NONE
case char // GTK_WRAP_CHAR
case word // GTK_WRAP_WORD
case wordChar // GTK_WRAP_WORD_CHAR
// swiftlint:disable discouraged_none_name
/// GTK_WRAP_NONE
case none
// swiftlint:enable discouraged_none_name
/// GTK_WRAP_CHAR
case char
/// GTK_WRAP_WORD
case word
/// GTK_WRAP_WORD_CHAR
case wordChar
/// Get the GtkWrapMode.
public var rawValue: GtkWrapMode { public var rawValue: GtkWrapMode {
switch self { switch self {
case .none: GTK_WRAP_NONE case .none:
case .char: GTK_WRAP_CHAR GTK_WRAP_NONE
case .word: GTK_WRAP_WORD case .char:
case .wordChar: GTK_WRAP_WORD_CHAR GTK_WRAP_CHAR
case .word:
GTK_WRAP_WORD
case .wordChar:
GTK_WRAP_WORD_CHAR
} }
} }
/// Initialize from the GtkWrapMode.
/// - Parameter rawValue: The GtkWrapMode.
public init?(rawValue: GtkWrapMode) { public init?(rawValue: GtkWrapMode) {
return nil nil
} }
} }

View File

@ -1,9 +1,19 @@
//
// GtkWrapMode.swift
// Adwaita
//
// Created by mlm on 24.08.25.
//
import CAdw import CAdw
/// Add ExpressibleByIntegerLiteral conformance to make GtkWrapMode usable as /// Add ExpressibleByIntegerLiteral conformance to make GtkWrapMode usable as
// a RawValue in an enum. /// a RawValue in an enum.
extension GtkWrapMode: @retroactive ExpressibleByIntegerLiteral { extension GtkWrapMode: @retroactive ExpressibleByIntegerLiteral {
/// Initialize from an integer literal.
public init(integerLiteral value: Int) { public init(integerLiteral value: Int) {
self.init(UInt32(value)) self.init(UInt32(value))
} }
} }