From 0a8f48b8627cfdf38c27a977e81835debcf6e518 Mon Sep 17 00:00:00 2001 From: Lakr <25259084+Lakr233@users.noreply.github.com> Date: Sun, 24 Mar 2024 10:24:25 +0800 Subject: [PATCH] Regular Update --- .../MultipartFormDataBoundaryGenerator.swift | 9 +-- .../Source/Sources/Network/Network.swift | 4 +- .../Timeline/TimelineSource+Fetcher.swift | 7 +- .../LoginChallenge/LoginChallenge.swift | 49 +++++++----- .../Network/Notes/NetworkWrapper+Notes.swift | 7 +- .../NoteTreeResolver/NoteTreeResolver.swift | 4 +- .../Tests/SourceTest/SourceTest+Meta.swift | 80 +++++++++---------- .../Source/Tests/SourceTest/Tests/User.swift | 8 +- Kimis/Backend/TextParser/TextParser.swift | 16 +++- Kimis/Extension/Generic/Swift.swift | 5 +- Kimis/Extension/Menu/ChidoriMenu.swift | 8 +- .../Menu/ChidoriPresentationController.swift | 8 +- .../Extension/Module/RemoteNotification.swift | 52 ++++++------ Kimis/Extension/UIKit/UIFont.swift | 8 +- Kimis/Extension/UIKit/UIImage+Fluent.swift | 4 +- .../EmojiPicker/EmojiPicker+Data.swift | 11 ++- .../ImageView/ImagePreviewController.swift | 22 ++--- .../Component/ImageView/MKImageView.swift | 4 +- .../AlignedCollectionViewFlowLayout.swift | 6 +- .../NoteCell/Abstract/NoteCell+Kind.swift | 40 +++++----- .../Context/NoteCell+ContextBuilder.swift | 6 +- .../Component/NoteView/NotePreview.swift | 11 +-- .../Component/NoteView/NoteView.swift | 11 +-- .../NoteOperationStrip+Share.swift | 7 +- .../PollView/ChoiceView+Snapshot.swift | 14 ++-- .../Reactions/ReactionStrip+Element.swift | 4 +- .../Abstract/NotificationCell+Kind.swift | 20 ++--- .../NotificationTableView+Delegate.swift | 4 +- .../Uploader/AttachUploadController.swift | 4 +- .../Uploader/UploadRequest.swift | 22 ++--- .../PostEditor/Toolbar/Toolbar+Poll.swift | 4 +- .../Toolbar/Toolbar+Visibility.swift | 8 +- .../PostEditor/Toolbar/ToolbarView.swift | 2 +- .../EndpointSwitchPopover.swift | 24 +++--- .../UserViewController+Profile.swift | 4 +- .../UserViewController+Update.swift | 9 +-- .../Interface/Routing/ControllerRouting.swift | 12 +-- 37 files changed, 269 insertions(+), 249 deletions(-) diff --git a/Foundation/Source/Sources/Network/Helper/MultipartFormDataBoundaryGenerator.swift b/Foundation/Source/Sources/Network/Helper/MultipartFormDataBoundaryGenerator.swift index 2d6cd35..5f3aefc 100644 --- a/Foundation/Source/Sources/Network/Helper/MultipartFormDataBoundaryGenerator.swift +++ b/Foundation/Source/Sources/Network/Helper/MultipartFormDataBoundaryGenerator.swift @@ -38,14 +38,13 @@ enum MultipartFormDataBoundaryGenerator { } static func boundary(forBoundaryType boundaryType: BoundaryType, boundaryKey: String) -> String { - let boundary: String - switch boundaryType { + let boundary = switch boundaryType { case .initial: - boundary = "--\(boundaryKey)\(EncodingCharacters.crlf)" + "--\(boundaryKey)\(EncodingCharacters.crlf)" case .encapsulated: - boundary = "\(EncodingCharacters.crlf)--\(boundaryKey)\(EncodingCharacters.crlf)" + "\(EncodingCharacters.crlf)--\(boundaryKey)\(EncodingCharacters.crlf)" case .final: - boundary = "\(EncodingCharacters.crlf)--\(boundaryKey)--\(EncodingCharacters.crlf)" + "\(EncodingCharacters.crlf)--\(boundaryKey)--\(EncodingCharacters.crlf)" } return boundary } diff --git a/Foundation/Source/Sources/Network/Network.swift b/Foundation/Source/Sources/Network/Network.swift index da83d0d..cffff4d 100644 --- a/Foundation/Source/Sources/Network/Network.swift +++ b/Foundation/Source/Sources/Network/Network.swift @@ -207,7 +207,9 @@ public extension Network { return } - for (key, value) in dic { dictionaryBuilder[key] = value } + for (key, value) in dic { + dictionaryBuilder[key] = value + } guard let newData = try? JSONSerialization .data(withJSONObject: dictionaryBuilder, options: .fragmentsAllowed) else { diff --git a/Foundation/Source/Sources/Source/DataSource/Timeline/TimelineSource+Fetcher.swift b/Foundation/Source/Sources/Source/DataSource/Timeline/TimelineSource+Fetcher.swift index 48f48e1..27435d5 100644 --- a/Foundation/Source/Sources/Source/DataSource/Timeline/TimelineSource+Fetcher.swift +++ b/Foundation/Source/Sources/Source/DataSource/Timeline/TimelineSource+Fetcher.swift @@ -78,12 +78,11 @@ extension TimelineSource { guard !downloadResult.isEmpty, !isCancelled else { return } let downloadAnchor = Anchor(dataset: downloadResult, ctx: base.ctx) - let inheritExists: Bool - switch direction { + let inheritExists: Bool = switch direction { case .older: - inheritExists = true + true case .newer: - inheritExists = downloadAnchor?.hasIntersection(to: base.anchor, withinCtx: base.ctx) + downloadAnchor?.hasIntersection(to: base.anchor, withinCtx: base.ctx) ?? false } diff --git a/Foundation/Source/Sources/Source/LoginChallenge/LoginChallenge.swift b/Foundation/Source/Sources/Source/LoginChallenge/LoginChallenge.swift index cb92a2a..80097b8 100644 --- a/Foundation/Source/Sources/Source/LoginChallenge/LoginChallenge.swift +++ b/Foundation/Source/Sources/Source/LoginChallenge/LoginChallenge.swift @@ -8,37 +8,48 @@ import Foundation private let requestPermission = [ + "read:admin", + "write:admin", + "read:account", - "write:account", "read:blocks", - "write:blocks", + "read:channels", + "read:clip", "read:drive", - "write:drive", "read:favorites", - "write:favorites", + "read:federation", + "read:flash", "read:following", - "write:following", + "read:gallery", + "read:invite", "read:messaging", - "write:messaging", "read:mutes", + "read:notifications", + "read:page", + "read:pages", + "read:reactions", + "read:user", + + "write:account", + "write:blocks", + "write:channels", + "write:clip", + "write:drive", + "write:favorites", + "write:flash", + "write:following", + "write:gallery", + "write:invite", + "write:messaging", "write:mutes", "write:notes", - "read:notifications", "write:notifications", - "read:reactions", + "write:page", + "write:pages", "write:reactions", + "write:report-abuse", + "write:user", "write:votes", - "read:pages", - "write:pages", - "write:page-likes", - "read:page-likes", - "read:user-groups", - "write:user-groups", - "read:channels", - "write:channels", - "read:gallery", - "write:gallery", - "read:gallery-likes", ] .joined(separator: ",") diff --git a/Foundation/Source/Sources/Source/Network/Notes/NetworkWrapper+Notes.swift b/Foundation/Source/Sources/Source/Network/Notes/NetworkWrapper+Notes.swift index 0c0e985..d966d77 100644 --- a/Foundation/Source/Sources/Source/Network/Notes/NetworkWrapper+Notes.swift +++ b/Foundation/Source/Sources/Source/Network/Notes/NetworkWrapper+Notes.swift @@ -110,11 +110,10 @@ public extension Source.NetworkWrapper { @discardableResult func requestNoteReaction(reactionIdentifier emoji: String?, forNote noteId: NoteID?) -> Note? { guard let ctx, let noteId else { return nil } - let result: NMNote? - if let emoji { - result = ctx.network.requestForReactionCreate(with: noteId, reaction: emoji) + let result: NMNote? = if let emoji { + ctx.network.requestForReactionCreate(with: noteId, reaction: emoji) } else { - result = ctx.network.requestForReactionDelete(with: noteId) + ctx.network.requestForReactionDelete(with: noteId) } ctx.spider.spidering(result) if let result { return .converting(result) } diff --git a/Foundation/Source/Sources/Source/NoteTreeResolver/NoteTreeResolver.swift b/Foundation/Source/Sources/Source/NoteTreeResolver/NoteTreeResolver.swift index d98c664..1e1714c 100644 --- a/Foundation/Source/Sources/Source/NoteTreeResolver/NoteTreeResolver.swift +++ b/Foundation/Source/Sources/Source/NoteTreeResolver/NoteTreeResolver.swift @@ -98,7 +98,9 @@ class NoteTreeResolver { let incompleteFather = iras.first?.incompleteFather // incomplete 标记位应该是全部都统一的 不然不会是一个 father #if DEBUG - for ira in iras { assert(ira.incompleteFather == incompleteFather) } + for ira in iras { + assert(ira.incompleteFather == incompleteFather) + } #endif // 将所有路径混合添加 let irb = IRB(father: fatherRoot, incompleteFather: incompleteFather) diff --git a/Foundation/Source/Tests/SourceTest/SourceTest+Meta.swift b/Foundation/Source/Tests/SourceTest/SourceTest+Meta.swift index 8c32be0..e564cd3 100644 --- a/Foundation/Source/Tests/SourceTest/SourceTest+Meta.swift +++ b/Foundation/Source/Tests/SourceTest/SourceTest+Meta.swift @@ -45,59 +45,59 @@ extension SourceTest { private extension Network.RequestTarget { var underlyingTestCase: Any? { switch self { - case .meta: return SourceTest.test_200_api_instance.self - case .emojis: return SourceTest.test_200_api_instance.self + case .meta: SourceTest.test_200_api_instance.self + case .emojis: SourceTest.test_200_api_instance.self - case .account_i: return SourceTest.test_201_api_user.self + case .account_i: SourceTest.test_201_api_user.self - case .i_favorites: return SourceTest.test_202_api_i_favorites.self - case .i_notification: return SourceTest.test_204_api_i_notification.self + case .i_favorites: SourceTest.test_202_api_i_favorites.self + case .i_notification: SourceTest.test_204_api_i_notification.self - case .following_create: return SourceTest.test_203_api_following.self - case .following_delete: return SourceTest.test_203_api_following.self - case .following_requests_accept: return SourceTest.test_203_api_following.self - case .following_requests_reject: return SourceTest.test_203_api_following.self - case .following_requests_cancel: return SourceTest.test_203_api_following.self - case .following_invalidate: return SourceTest.test_203_api_following.self + case .following_create: SourceTest.test_203_api_following.self + case .following_delete: SourceTest.test_203_api_following.self + case .following_requests_accept: SourceTest.test_203_api_following.self + case .following_requests_reject: SourceTest.test_203_api_following.self + case .following_requests_cancel: SourceTest.test_203_api_following.self + case .following_invalidate: SourceTest.test_203_api_following.self - case .users: return SourceTest.test_203_api_following.self - case .users_report_abuse: return SourceTest.test_215_report_abuse.self - case .user_show: return SourceTest.test_203_api_following.self - case .users_followers: return SourceTest.test_203_api_following.self - case .users_following: return SourceTest.test_203_api_following.self + case .users: SourceTest.test_203_api_following.self + case .users_report_abuse: SourceTest.test_215_report_abuse.self + case .user_show: SourceTest.test_203_api_following.self + case .users_followers: SourceTest.test_203_api_following.self + case .users_following: SourceTest.test_203_api_following.self - case .user_notes: return SourceTest.test_205_api_user.self + case .user_notes: SourceTest.test_205_api_user.self - case .blocking_create: return SourceTest.test_206_api_block.self - case .blocking_delete: return SourceTest.test_206_api_block.self + case .blocking_create: SourceTest.test_206_api_block.self + case .blocking_delete: SourceTest.test_206_api_block.self - case .notes_create: return SourceTest.test_207_notes_create_delete.self - case .notes_delete: return SourceTest.test_207_notes_create_delete.self + case .notes_create: SourceTest.test_207_notes_create_delete.self + case .notes_delete: SourceTest.test_207_notes_create_delete.self - case .notes_show: return SourceTest.test_208_notes_status.self - case .notes_state: return SourceTest.test_208_notes_status.self + case .notes_show: SourceTest.test_208_notes_status.self + case .notes_state: SourceTest.test_208_notes_status.self - case .notes_reactions: return SourceTest.test_208_notes_status.self - case .notes_reactions_create: return SourceTest.test_208_notes_status.self - case .notes_reactions_delete: return SourceTest.test_208_notes_status.self - case .notes_favorites_create: return SourceTest.test_208_notes_status.self - case .notes_favorites_delete: return SourceTest.test_208_notes_status.self + case .notes_reactions: SourceTest.test_208_notes_status.self + case .notes_reactions_create: SourceTest.test_208_notes_status.self + case .notes_reactions_delete: SourceTest.test_208_notes_status.self + case .notes_favorites_create: SourceTest.test_208_notes_status.self + case .notes_favorites_delete: SourceTest.test_208_notes_status.self - case .notes_timeline: return SourceTest.test_209_timeline.self - case .notes_global_timeline: return SourceTest.test_209_timeline.self - case .notes_hybrid_timeline: return SourceTest.test_209_timeline.self - case .notes_local_timeline: return SourceTest.test_209_timeline.self + case .notes_timeline: SourceTest.test_209_timeline.self + case .notes_global_timeline: SourceTest.test_209_timeline.self + case .notes_hybrid_timeline: SourceTest.test_209_timeline.self + case .notes_local_timeline: SourceTest.test_209_timeline.self - case .notes_replies: return SourceTest.test_210_notes_replies.self - case .notes_search_by_tag: return SourceTest.test_211_notes_search.self - case .notes_polls_vote: return SourceTest.test_212_notes_polls_vote.self - case .notes_search: return SourceTest.test_211_notes_search.self + case .notes_replies: SourceTest.test_210_notes_replies.self + case .notes_search_by_tag: SourceTest.test_211_notes_search.self + case .notes_polls_vote: SourceTest.test_212_notes_polls_vote.self + case .notes_search: SourceTest.test_211_notes_search.self - case .hashtags_trend: return SourceTest.test_213_hashtag_trand.self + case .hashtags_trend: SourceTest.test_213_hashtag_trand.self - case .drive_files: return SourceTest.test_214_drive_file.self - case .drive_files_create: return SourceTest.test_214_drive_file.self - case .drive_files_update: return SourceTest.test_214_drive_file.self + case .drive_files: SourceTest.test_214_drive_file.self + case .drive_files_create: SourceTest.test_214_drive_file.self + case .drive_files_update: SourceTest.test_214_drive_file.self // @unknown default: return nil } diff --git a/Foundation/Source/Tests/SourceTest/Tests/User.swift b/Foundation/Source/Tests/SourceTest/Tests/User.swift index 9e48859..6d23fde 100644 --- a/Foundation/Source/Tests/SourceTest/Tests/User.swift +++ b/Foundation/Source/Tests/SourceTest/Tests/User.swift @@ -94,7 +94,7 @@ extension SourceTest { let ans = source.network.requestForUserFollowing(userId: userId) unwrapOrFail(ans) { item in var found = false - item.forEach { record in + for record in item { XCTAssertEqual(record.followerId, userId) if record.followeeId == user2.userId { found = true } } @@ -107,7 +107,7 @@ extension SourceTest { let ans = source.network.requestForUserFollowing(userId: userId) unwrapOrFail(ans) { item in var found = false - item.forEach { record in + for record in item { XCTAssertEqual(record.followeeId, userId) if record.followeeId == user2.userId { found = true } } @@ -162,7 +162,7 @@ extension SourceTest { let ans = source.network.requestForUserFollowers(userId: userId) unwrapOrFail(ans) { item in var found = false - item.forEach { record in + for record in item { XCTAssertEqual(record.followeeId, userId) if record.followerId == user2.userId { found = true } } @@ -185,7 +185,7 @@ extension SourceTest { let ans = source.network.requestForUserFollowers(userId: userId) unwrapOrFail(ans) { item in var found = false - item.forEach { record in + for record in item { XCTAssertEqual(record.followeeId, userId) if record.followerId == user3.userId { found = true } } diff --git a/Kimis/Backend/TextParser/TextParser.swift b/Kimis/Backend/TextParser/TextParser.swift index 8c3f303..1f73c6c 100644 --- a/Kimis/Backend/TextParser/TextParser.swift +++ b/Kimis/Backend/TextParser/TextParser.swift @@ -99,10 +99,18 @@ extension TextParser { replaceAttributeForSimpleUsername(with: string, defaultHost: defaultHost) replaceAttributeForLinks(with: string) replaceTinyEmoji(from: string, defaultHost: defaultHost) - while string.string.hasPrefix(" ") { string.deleteCharacters(in: NSRange(location: 0, length: 1)) } - while string.string.hasPrefix("\n") { string.deleteCharacters(in: NSRange(location: 0, length: 1)) } - while string.string.hasSuffix(" ") { string.deleteCharacters(in: NSRange(location: string.length - 1, length: 1)) } - while string.string.hasSuffix("\n") { string.deleteCharacters(in: NSRange(location: string.length - 1, length: 1)) } + while string.string.hasPrefix(" ") { + string.deleteCharacters(in: NSRange(location: 0, length: 1)) + } + while string.string.hasPrefix("\n") { + string.deleteCharacters(in: NSRange(location: 0, length: 1)) + } + while string.string.hasSuffix(" ") { + string.deleteCharacters(in: NSRange(location: string.length - 1, length: 1)) + } + while string.string.hasSuffix("\n") { + string.deleteCharacters(in: NSRange(location: string.length - 1, length: 1)) + } attributeFullFill(string) return string } diff --git a/Kimis/Extension/Generic/Swift.swift b/Kimis/Extension/Generic/Swift.swift index c9d437b..f0af6e8 100644 --- a/Kimis/Extension/Generic/Swift.swift +++ b/Kimis/Extension/Generic/Swift.swift @@ -10,14 +10,15 @@ import Foundation @inline(__always) func debugPrint(_ items: Any..., separator: String = " ", terminator: String = "\n") { #if DEBUG - items.forEach { - Swift.print($0, separator: separator, terminator: terminator) + for item in items { + Swift.print(item, separator: separator, terminator: terminator) } #endif } #if DEBUG import SDWebImage + func clearSDWebImageCache() { SDImageCache.shared.clearMemory() SDImageCache.shared.clearDisk() diff --git a/Kimis/Extension/Menu/ChidoriMenu.swift b/Kimis/Extension/Menu/ChidoriMenu.swift index 5d68e21..257cbda 100644 --- a/Kimis/Extension/Menu/ChidoriMenu.swift +++ b/Kimis/Extension/Menu/ChidoriMenu.swift @@ -150,14 +150,14 @@ class ChidoriMenu: UIViewController { let menuChildren: [UIMenu] = [wrapperMenu] snapshot.appendSections(menuChildren) - menuChildren.forEach { - snapshot.appendItems($0.children as! [UIAction], toSection: $0) + for menuChild in menuChildren { + snapshot.appendItems(menuChild.children as! [UIAction], toSection: menuChild) } } else if let menuChildren = menu.children as? [UIMenu] { snapshot.appendSections(menuChildren) - menuChildren.forEach { - snapshot.appendItems($0.children as! [UIAction], toSection: $0) + for menuChild in menuChildren { + snapshot.appendItems(menuChild.children as! [UIAction], toSection: menuChild) } } else { preconditionFailure("Incorrect format. Do not mix UIAction and UIMenu in menu children for ChidoriMenu use.") diff --git a/Kimis/Extension/Menu/ChidoriPresentationController.swift b/Kimis/Extension/Menu/ChidoriPresentationController.swift index 9bee3ad..dea7a57 100644 --- a/Kimis/Extension/Menu/ChidoriPresentationController.swift +++ b/Kimis/Extension/Menu/ChidoriPresentationController.swift @@ -121,15 +121,13 @@ class ChidoriPresentationController: UIPresentationController { return min(rightMostPermissableXPosition, max(leftShiftedPoint, lowestPermissableXPosition)) }() - let y: CGFloat = { - // Check if we have enough room to place it below the touch point + let y: CGFloat = // Check if we have enough room to place it below the touch point if summonPoint.y + menuSize.height + offsetFromFinger + requiredSidePadding < containerView.bounds.height - containerView.safeAreaInsets.bottom { - return summonPoint.y + offsetFromFinger + summonPoint.y + offsetFromFinger } else { // If not, iOS tries to keep as much in the bottom half of the screen as possible (to be closer to where the thumb normally is, presumably) so mimic that - return containerView.bounds.height - requiredSidePadding - containerView.safeAreaInsets.bottom - menuSize.height + containerView.bounds.height - requiredSidePadding - containerView.safeAreaInsets.bottom - menuSize.height } - }() return CGPoint(x: x, y: y) } diff --git a/Kimis/Extension/Module/RemoteNotification.swift b/Kimis/Extension/Module/RemoteNotification.swift index c1f2a4e..e1ad669 100644 --- a/Kimis/Extension/Module/RemoteNotification.swift +++ b/Kimis/Extension/Module/RemoteNotification.swift @@ -10,39 +10,39 @@ import UIKit extension RemoteNotification.Kind { var tintIcon: UIImage? { switch self { - case .follow: return UIImage(systemName: "person.crop.circle.badge.plus") - case .mention: return UIImage(systemName: "at") - case .reply: return UIImage(systemName: "arrowshape.turn.up.left.circle.fill") - case .renote: return UIImage(systemName: "arrowshape.turn.up.right.circle.fill") - case .quote: return UIImage(systemName: "quote.bubble") - case .reaction: return nil - case .pollVote: return UIImage(systemName: "checkmark.circle.fill") - case .pollEnded: return UIImage(systemName: "timeline.selection") - case .receiveFollowRequest: return UIImage(systemName: "person.crop.square") - case .followRequestAccepted: return UIImage(systemName: "person.crop.circle.badge.checkmark") - case .groupInvited: return UIImage(systemName: "person.fill.badge.plus") - case .app: return UIImage(systemName: "app.badge.fill") + case .follow: UIImage(systemName: "person.crop.circle.badge.plus") + case .mention: UIImage(systemName: "at") + case .reply: UIImage(systemName: "arrowshape.turn.up.left.circle.fill") + case .renote: UIImage(systemName: "arrowshape.turn.up.right.circle.fill") + case .quote: UIImage(systemName: "quote.bubble") + case .reaction: nil + case .pollVote: UIImage(systemName: "checkmark.circle.fill") + case .pollEnded: UIImage(systemName: "timeline.selection") + case .receiveFollowRequest: UIImage(systemName: "person.crop.square") + case .followRequestAccepted: UIImage(systemName: "person.crop.circle.badge.checkmark") + case .groupInvited: UIImage(systemName: "person.fill.badge.plus") + case .app: UIImage(systemName: "app.badge.fill") - default: return UIImage(systemName: "questionmark.circle") + default: UIImage(systemName: "questionmark.circle") } } var title: String { switch self { - case .follow: return "Followed you" - case .mention: return "Mentioned you" - case .reply: return "Replied to you" - case .renote: return "Forward your note" - case .quote: return "Quote" - case .reaction: return "Reacted with you" - case .pollVote: return "Voted a poll" - case .pollEnded: return "Poll ended" - case .receiveFollowRequest: return "You have a follow request" - case .followRequestAccepted: return "Your follow request was accepted" - case .groupInvited: return "You are invited" - case .app: return "Application Message" + case .follow: "Followed you" + case .mention: "Mentioned you" + case .reply: "Replied to you" + case .renote: "Forward your note" + case .quote: "Quote" + case .reaction: "Reacted with you" + case .pollVote: "Voted a poll" + case .pollEnded: "Poll ended" + case .receiveFollowRequest: "You have a follow request" + case .followRequestAccepted: "Your follow request was accepted" + case .groupInvited: "You are invited" + case .app: "Application Message" - default: return "Unknown Message" + default: "Unknown Message" } } } diff --git a/Kimis/Extension/UIKit/UIFont.swift b/Kimis/Extension/UIKit/UIFont.swift index 82ab005..3d5dc00 100644 --- a/Kimis/Extension/UIKit/UIFont.swift +++ b/Kimis/Extension/UIKit/UIFont.swift @@ -10,12 +10,10 @@ import UIKit extension UIFont { class func rounded(ofSize size: CGFloat, weight: UIFont.Weight) -> UIFont { let systemFont = UIFont.systemFont(ofSize: size, weight: weight) - let font: UIFont - - if let descriptor = systemFont.fontDescriptor.withDesign(.rounded) { - font = UIFont(descriptor: descriptor, size: size) + let font: UIFont = if let descriptor = systemFont.fontDescriptor.withDesign(.rounded) { + UIFont(descriptor: descriptor, size: size) } else { - font = systemFont + systemFont } return font } diff --git a/Kimis/Extension/UIKit/UIImage+Fluent.swift b/Kimis/Extension/UIKit/UIImage+Fluent.swift index 3931b5d..da3251b 100644 --- a/Kimis/Extension/UIKit/UIImage+Fluent.swift +++ b/Kimis/Extension/UIKit/UIImage+Fluent.swift @@ -87,7 +87,9 @@ extension UIImage { #if DEBUG if !checked { let items = FluentIcon.allCases.map(\.rawValue) - for item in items { assert(UIImage(named: item) != nil) } + for item in items { + assert(UIImage(named: item) != nil) + } checked = true print("[*] FluentIcon Resources Checked!") } diff --git a/Kimis/Interface/Component/EmojiPicker/EmojiPicker+Data.swift b/Kimis/Interface/Component/EmojiPicker/EmojiPicker+Data.swift index e6150be..a2c9cbf 100644 --- a/Kimis/Interface/Component/EmojiPicker/EmojiPicker+Data.swift +++ b/Kimis/Interface/Component/EmojiPicker/EmojiPicker+Data.swift @@ -56,8 +56,8 @@ extension EmojiPickerView { if !instanceEmojis.isEmpty { var build: [String: [EmojiElement]] = [:] - instanceEmojis.forEach { - build[$0.category, default: []].append(.init(emoji: $0)) + for instanceEmoji in instanceEmojis { + build[instanceEmoji.category, default: []].append(.init(emoji: instanceEmoji)) } for key in build.keys.sorted() { guard let section = build[key] else { continue } @@ -89,11 +89,10 @@ extension EmojiPickerView { } func buildSearchResultAndReload(for searchText: String) { - let newDataSource: [EmojiSection] - if searchText.isEmpty { - newDataSource = rawDataSource + let newDataSource: [EmojiSection] = if searchText.isEmpty { + rawDataSource } else { - newDataSource = searchFiltering(text: searchText) + searchFiltering(text: searchText) } reloadWithAnimation(with: newDataSource) } diff --git a/Kimis/Interface/Component/ImageView/ImagePreviewController.swift b/Kimis/Interface/Component/ImageView/ImagePreviewController.swift index bde340e..61c2aa5 100644 --- a/Kimis/Interface/Component/ImageView/ImagePreviewController.swift +++ b/Kimis/Interface/Component/ImageView/ImagePreviewController.swift @@ -70,17 +70,17 @@ class ImagePreviewController: QLPreviewController, QLPreviewControllerDataSource extension SDImageFormat { var possiblePathExtension: String { switch self { - case .undefined: return "" - case .JPEG: return "jpg" - case .PNG: return "png" - case .GIF: return "gif" - case .TIFF: return "tiff" - case .webP: return "webp" - case .HEIC: return "heic" - case .HEIF: return "heif" - case .PDF: return "pdf" - case .SVG: return "svg" - default: return "" + case .undefined: "" + case .JPEG: "jpg" + case .PNG: "png" + case .GIF: "gif" + case .TIFF: "tiff" + case .webP: "webp" + case .HEIC: "heic" + case .HEIF: "heif" + case .PDF: "pdf" + case .SVG: "svg" + default: "" } // static const SDImageFormat SDImageFormatUndefined = -1; // static const SDImageFormat SDImageFormatJPEG = 0; diff --git a/Kimis/Interface/Component/ImageView/MKImageView.swift b/Kimis/Interface/Component/ImageView/MKImageView.swift index a0a504f..18250d4 100644 --- a/Kimis/Interface/Component/ImageView/MKImageView.swift +++ b/Kimis/Interface/Component/ImageView/MKImageView.swift @@ -120,7 +120,9 @@ class MKImageRenderView: UIView { override func layoutSubviews() { super.layoutSubviews() let bounds = bounds - for view in subviews { view.frame = bounds } + for view in subviews { + view.frame = bounds + } } @available(*, unavailable) diff --git a/Kimis/Interface/Component/Misc/AlignedCollectionViewFlowLayout.swift b/Kimis/Interface/Component/Misc/AlignedCollectionViewFlowLayout.swift index fd6c940..9cc3fab 100644 --- a/Kimis/Interface/Component/Misc/AlignedCollectionViewFlowLayout.swift +++ b/Kimis/Interface/Component/Misc/AlignedCollectionViewFlowLayout.swift @@ -297,12 +297,12 @@ private extension UICollectionViewLayoutAttributes { /// - Returns: `true` if the represented item is the first item in the line, else `false`. func isRepresentingFirstItemInLine(collectionViewLayout: AlignedCollectionViewFlowLayout) -> Bool { if currentItem <= 0 { - return true + true } else { if let layoutAttributesForPrecedingItem = collectionViewLayout.originalLayoutAttribute(forItemAt: precedingIndexPath) { - return !collectionViewLayout.isFrame(for: self, inSameLineAsFrameFor: layoutAttributesForPrecedingItem) + !collectionViewLayout.isFrame(for: self, inSameLineAsFrameFor: layoutAttributesForPrecedingItem) } else { - return true + true } } } diff --git a/Kimis/Interface/Component/NoteTableView/NoteCell/Abstract/NoteCell+Kind.swift b/Kimis/Interface/Component/NoteTableView/NoteCell/Abstract/NoteCell+Kind.swift index b0d0fe3..c824186 100644 --- a/Kimis/Interface/Component/NoteTableView/NoteCell/Abstract/NoteCell+Kind.swift +++ b/Kimis/Interface/Component/NoteTableView/NoteCell/Abstract/NoteCell+Kind.swift @@ -24,36 +24,36 @@ extension NoteCell { var cellId: String { rawValue } var cell: NoteCell.Type { switch self { - case .abstract: return NoteCell.self - case .separator: return NoteCell.Separator.self - case .progress: return NoteCell.Progress.self - case .moreHeader: return MoreHeaderCell.self - case .main: return MainCell.self - case .pinned: return PinnedCell.self - case .reply: return ReplyCell.self - case .full: return FullCell.self - case .moreReply: return MoreReplyHeaderCell.self - case .moreReplyPadded: return MoreReplyPaddedCell.self - case .replyPadded: return ReplyPaddedCell.self + case .abstract: NoteCell.self + case .separator: NoteCell.Separator.self + case .progress: NoteCell.Progress.self + case .moreHeader: MoreHeaderCell.self + case .main: MainCell.self + case .pinned: PinnedCell.self + case .reply: ReplyCell.self + case .full: FullCell.self + case .moreReply: MoreReplyHeaderCell.self + case .moreReplyPadded: MoreReplyPaddedCell.self + case .replyPadded: ReplyPaddedCell.self } } var designatedHeight: CGFloat? { switch self { - case .separator: return 1 - case .moreHeader, .moreReplyPadded, .moreReply, .progress: return 30 - default: return nil + case .separator: 1 + case .moreHeader, .moreReplyPadded, .moreReply, .progress: 30 + default: nil } } var isSupplymentKind: Bool { switch self { - case .abstract: return true - case .separator: return true - case .progress: return true - case .moreHeader: return true - case .moreReply: return true - default: return false + case .abstract: true + case .separator: true + case .progress: true + case .moreHeader: true + case .moreReply: true + default: false } } } diff --git a/Kimis/Interface/Component/NoteTableView/NoteCell/Context/NoteCell+ContextBuilder.swift b/Kimis/Interface/Component/NoteTableView/NoteCell/Context/NoteCell+ContextBuilder.swift index b9ff068..15e8fec 100644 --- a/Kimis/Interface/Component/NoteTableView/NoteCell/Context/NoteCell+ContextBuilder.swift +++ b/Kimis/Interface/Component/NoteTableView/NoteCell/Context/NoteCell+ContextBuilder.swift @@ -60,9 +60,9 @@ extension NoteNode { } else if repliesCtx.count >= 3 { // 有太多的回复 大概率是关注的 po 主回复了一堆人 实测两条已经很顶了 所以加一层处理 // 关闭 operation button 和 header - repliesCtx.forEach { - $0.disableOperationStrip = true - $0.disablePreviewReason = true + for item in repliesCtx { + item.disableOperationStrip = true + item.disablePreviewReason = true } } repliesCtx.sort { $0.noteId ?? "" < $1.noteId ?? "" } diff --git a/Kimis/Interface/Component/NoteView/NotePreview.swift b/Kimis/Interface/Component/NoteView/NotePreview.swift index c2bbcb8..cb37e3a 100644 --- a/Kimis/Interface/Component/NoteView/NotePreview.swift +++ b/Kimis/Interface/Component/NoteView/NotePreview.swift @@ -124,7 +124,9 @@ class NotePreview: UIView { renotePreview.snapshot = snapshot?.renoteSnapshot attachments.snapshot = snapshot?.attachmentSnapshot reactions.snapshot = snapshot?.reactionSnapshot - for view in subviews { view.layoutSubviews() } + for view in subviews { + view.layoutSubviews() + } } func clear() { @@ -442,16 +444,15 @@ extension NotePreview.Snapshot { height: reactionHeight > 0 ? reactionHeight : -verticalSpacing ) - let operationRect: CGRect - if context.disableOperationStrip { - operationRect = CGRect( + let operationRect = if context.disableOperationStrip { + CGRect( x: contentLeftAlign, y: reactionRect.origin.y + reactionRect.size.height, width: contentWidth, height: 0 ) } else { - operationRect = CGRect( + CGRect( x: contentLeftAlign, y: reactionRect.origin.y + reactionRect.size.height + verticalSpacing, width: contentWidth, diff --git a/Kimis/Interface/Component/NoteView/NoteView.swift b/Kimis/Interface/Component/NoteView/NoteView.swift index bb5c568..840c7c1 100644 --- a/Kimis/Interface/Component/NoteView/NoteView.swift +++ b/Kimis/Interface/Component/NoteView/NoteView.swift @@ -106,7 +106,9 @@ class NoteView: UIView { renotePreview.snapshot = snapshot?.renoteSnapshot attachments.snapshot = snapshot?.attachmentSnapshot reactions.snapshot = snapshot?.reactionSnapshot - for view in subviews { view.layoutSubviews() } + for view in subviews { + view.layoutSubviews() + } } func clear() { @@ -283,16 +285,15 @@ extension NoteView.Snapshot { let userTextX = avatarRect.maxX + horizontalSpacing let userTextWidth = width - avatarRect.width - horizontalSpacing let userTextHeight = userText.measureHeight(usingWidth: userTextWidth) - let userTextRect: CGRect - if userTextHeight > avatarRect.height { - userTextRect = CGRect( + let userTextRect = if userTextHeight > avatarRect.height { + CGRect( x: userTextX, y: avatarRect.minY, width: userTextWidth, height: userTextHeight ) } else { - userTextRect = CGRect( + CGRect( x: userTextX, y: avatarRect.minY + (avatarRect.height - userTextHeight) / 2, width: userTextWidth, diff --git a/Kimis/Interface/Component/NoteView/OperationStack/NoteOperationStrip+Share.swift b/Kimis/Interface/Component/NoteView/OperationStack/NoteOperationStrip+Share.swift index bae8e68..21042d1 100644 --- a/Kimis/Interface/Component/NoteView/OperationStack/NoteOperationStrip+Share.swift +++ b/Kimis/Interface/Component/NoteView/OperationStack/NoteOperationStrip+Share.swift @@ -147,11 +147,10 @@ private class NoteShareItemSource: NSObject, UIActivityItemSource { if !note.attachments.isEmpty { items.append("📎x\(note.attachments.count)") } let buildBody = items.joined(separator: " ") - let build: String - if buildBody.isEmpty { - build = "\(name)" + let build = if buildBody.isEmpty { + "\(name)" } else { - build = "\(name): \(buildBody)" + "\(name): \(buildBody)" } linkMetadata.title = build diff --git a/Kimis/Interface/Component/NoteView/PollView/ChoiceView+Snapshot.swift b/Kimis/Interface/Component/NoteView/PollView/ChoiceView+Snapshot.swift index 0ec04b3..a5c248a 100644 --- a/Kimis/Interface/Component/NoteView/PollView/ChoiceView+Snapshot.swift +++ b/Kimis/Interface/Component/NoteView/PollView/ChoiceView+Snapshot.swift @@ -96,16 +96,15 @@ extension PollView.ChoiceView.Snapshot { ])) let countTextWidth = countText.measureWidth() let countTextHeight = countText.measureHeight(usingWidth: .infinity) - var countTextRect: CGRect - if countTextHeight < iconSize { - countTextRect = CGRect( + var countTextRect = if countTextHeight < iconSize { + CGRect( x: width - horizontalPadding - countTextWidth, y: verticalPadding + (iconSize - countTextHeight) / 2, width: countTextWidth, height: countTextHeight ) } else { - countTextRect = CGRect( + CGRect( x: width - horizontalPadding - countTextWidth, y: verticalPadding, width: countTextWidth, @@ -116,16 +115,15 @@ extension PollView.ChoiceView.Snapshot { let text = textParser.finalize(.init(string: element.text)) let textWidth = countTextRect.minX - horizontalPadding - horizontalPadding - iconRect.maxX let textHeight = text.measureHeight(usingWidth: textWidth) - var textRect: CGRect - if textHeight < iconSize { - textRect = CGRect( + var textRect = if textHeight < iconSize { + CGRect( x: iconRect.maxX + horizontalPadding, y: verticalPadding + (iconSize - textHeight) / 2, width: textWidth, height: textHeight ) } else { - textRect = CGRect( + CGRect( x: iconRect.maxX + horizontalPadding, y: verticalPadding, width: textWidth, diff --git a/Kimis/Interface/Component/NoteView/Reactions/ReactionStrip+Element.swift b/Kimis/Interface/Component/NoteView/Reactions/ReactionStrip+Element.swift index 8f44d67..1e47044 100644 --- a/Kimis/Interface/Component/NoteView/Reactions/ReactionStrip+Element.swift +++ b/Kimis/Interface/Component/NoteView/Reactions/ReactionStrip+Element.swift @@ -17,8 +17,8 @@ extension ReactionStrip { let isUserReaction: Bool var validated: Bool { - if text == nil { return url != nil } - else { return url == nil } + if text == nil { url != nil } + else { url == nil } } let representImageReaction: String? diff --git a/Kimis/Interface/Component/NotificationTableView/NotificationCell/Abstract/NotificationCell+Kind.swift b/Kimis/Interface/Component/NotificationTableView/NotificationCell/Abstract/NotificationCell+Kind.swift index acc101a..a7911b0 100644 --- a/Kimis/Interface/Component/NotificationTableView/NotificationCell/Abstract/NotificationCell+Kind.swift +++ b/Kimis/Interface/Component/NotificationTableView/NotificationCell/Abstract/NotificationCell+Kind.swift @@ -37,27 +37,27 @@ extension NotificationCell.CellKind { var cellId: String { rawValue } var cell: NotificationCell.Type { switch self { - case .main: return NotificationCell.MainCell.self + case .main: NotificationCell.MainCell.self - case .progress: return NotificationCell.ProgressCell.self - case .separator: return NotificationCell.SeparatorCell.self - case .unsupported: return NotificationCell.UnsupportedCell.self + case .progress: NotificationCell.ProgressCell.self + case .separator: NotificationCell.SeparatorCell.self + case .unsupported: NotificationCell.UnsupportedCell.self } } var designatedHeight: CGFloat? { switch self { - case .separator: return 1 - case .progress, .unsupported: return 30 - default: return nil + case .separator: 1 + case .progress, .unsupported: 30 + default: nil } } var isSupplymentKind: Bool { switch self { - case .separator: return true - case .progress, .unsupported: return true - default: return false + case .separator: true + case .progress, .unsupported: true + default: false } } } diff --git a/Kimis/Interface/Component/NotificationTableView/NotificationTableView/NotificationTableView+Delegate.swift b/Kimis/Interface/Component/NotificationTableView/NotificationTableView/NotificationTableView+Delegate.swift index 22c889f..7728ead 100644 --- a/Kimis/Interface/Component/NotificationTableView/NotificationTableView/NotificationTableView+Delegate.swift +++ b/Kimis/Interface/Component/NotificationTableView/NotificationTableView/NotificationTableView+Delegate.swift @@ -59,14 +59,14 @@ extension NotificationTableView: UITableViewDelegate, UITableViewDataSource { .map(\.kind) .filter { value in switch value { - case .main: return true + case .main: true // case .note: return true // case .reaction: return true // case .follow: return true // case .followRequest: return true // case .followAccepted: return true // case .vote: return true - default: return false + default: false } } .count diff --git a/Kimis/Interface/Controller/PostController/PostEditor/SupplymentController/Uploader/AttachUploadController.swift b/Kimis/Interface/Controller/PostController/PostEditor/SupplymentController/Uploader/AttachUploadController.swift index 883785b..d8a1591 100644 --- a/Kimis/Interface/Controller/PostController/PostEditor/SupplymentController/Uploader/AttachUploadController.swift +++ b/Kimis/Interface/Controller/PostController/PostEditor/SupplymentController/Uploader/AttachUploadController.swift @@ -53,8 +53,8 @@ class AttachUploadController: ViewController { navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(cancelUpload)) - requests.forEach { - $0.updated + for request in requests { + request.updated .sink { [weak self] _ in self?.checkAndPopWhenComplete() } diff --git a/Kimis/Interface/Controller/PostController/PostEditor/SupplymentController/Uploader/UploadRequest.swift b/Kimis/Interface/Controller/PostController/PostEditor/SupplymentController/Uploader/UploadRequest.swift index 083f009..c29edb9 100644 --- a/Kimis/Interface/Controller/PostController/PostEditor/SupplymentController/Uploader/UploadRequest.swift +++ b/Kimis/Interface/Controller/PostController/PostEditor/SupplymentController/Uploader/UploadRequest.swift @@ -106,32 +106,32 @@ extension AttachUploadController.UploadRequest { extension AttachUploadController.UploadRequest.Status { var title: String { switch self { - case .pending: return "Pending" - case .uploading: return "Uploading" - case .done: return "Uploaded" - case .failed: return "Failed" + case .pending: "Pending" + case .uploading: "Uploading" + case .done: "Uploaded" + case .failed: "Failed" } } var color: UIColor? { switch self { - case .failed: return .systemPink - default: return nil + case .failed: .systemPink + default: nil } } var icon: UIImage? { switch self { - case .done: return .init(systemName: "checkmark.circle.fill") - case .failed: return .init(systemName: "xmark.circle.fill") - default: return nil + case .done: .init(systemName: "checkmark.circle.fill") + case .failed: .init(systemName: "xmark.circle.fill") + default: nil } } var iconColor: UIColor { switch self { - case .failed: return .systemPink - default: return .accent + case .failed: .systemPink + default: .accent } } } diff --git a/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/Toolbar+Poll.swift b/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/Toolbar+Poll.swift index 947fb10..8161723 100644 --- a/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/Toolbar+Poll.swift +++ b/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/Toolbar+Poll.swift @@ -25,9 +25,9 @@ extension PostEditorToolbarView { }), ], toolIcon: { post in if post.poll == nil { - return UIImage.fluent(.task_list_add_filled) + UIImage.fluent(.task_list_add_filled) } else { - return UIImage.fluent(.text_grammar_dismiss) + UIImage.fluent(.text_grammar_dismiss) } }, toolEnabled: { _ in true diff --git a/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/Toolbar+Visibility.swift b/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/Toolbar+Visibility.swift index 629591e..0e9a7b3 100644 --- a/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/Toolbar+Visibility.swift +++ b/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/Toolbar+Visibility.swift @@ -22,10 +22,10 @@ extension PostEditorToolbarView { // TODO: mail to target ], toolIcon: { post in switch post.visibility { - case .public: return .fluent(.globe_person_filled) - case .followers: return .fluent(.checkbox_person_filled) - case .home: return .fluent(.home_person_filled) - case .specified: return .fluent(.person_mail_filled) + case .public: .fluent(.globe_person_filled) + case .followers: .fluent(.checkbox_person_filled) + case .home: .fluent(.home_person_filled) + case .specified: .fluent(.person_mail_filled) } }, toolEnabled: { _ in true diff --git a/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/ToolbarView.swift b/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/ToolbarView.swift index 9e9ae55..6404371 100644 --- a/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/ToolbarView.swift +++ b/Kimis/Interface/Controller/PostController/PostEditor/Toolbar/ToolbarView.swift @@ -127,7 +127,7 @@ class PostEditorToolbarView: UIView { } func updateIcons() { - toolButtons.forEach { toolItem in + for toolItem in toolButtons { toolItem.updateAppearance() } } diff --git a/Kimis/Interface/Controller/TimelineController/EndpointSwitchPopover.swift b/Kimis/Interface/Controller/TimelineController/EndpointSwitchPopover.swift index e2f83dc..99ca8c3 100644 --- a/Kimis/Interface/Controller/TimelineController/EndpointSwitchPopover.swift +++ b/Kimis/Interface/Controller/TimelineController/EndpointSwitchPopover.swift @@ -184,28 +184,28 @@ extension EndpointSwitchPopover { private extension TimelineSource.Endpoint { var representedIcon: UIImage { switch self { - case .home: return .fluent(.reading_list_filled) - case .local: return .fluent(.city_filled) - case .hybrid: return .fluent(.cloud_swap_filled) - case .global: return .fluent(.gantt_chart_filled) + case .home: .fluent(.reading_list_filled) + case .local: .fluent(.city_filled) + case .hybrid: .fluent(.cloud_swap_filled) + case .global: .fluent(.gantt_chart_filled) } } var title: String { switch self { - case .home: return "Home" - case .local: return "Local" - case .hybrid: return "Hybrid" - case .global: return "Global" + case .home: "Home" + case .local: "Local" + case .hybrid: "Hybrid" + case .global: "Global" } } var explanation: String { switch self { - case .home: return "Your main timeline at a glance, with posts from the people you follow." - case .local: return "Notes on your server." - case .hybrid: return "Notes on local and remote servers." - case .global: return "Everything you need to know about everything." + case .home: "Your main timeline at a glance, with posts from the people you follow." + case .local: "Notes on your server." + case .hybrid: "Notes on local and remote servers." + case .global: "Everything you need to know about everything." } } } diff --git a/Kimis/Interface/Controller/UserController/UserProfileController/UserViewController+Profile.swift b/Kimis/Interface/Controller/UserController/UserProfileController/UserViewController+Profile.swift index 1b3900c..77da193 100644 --- a/Kimis/Interface/Controller/UserController/UserProfileController/UserViewController+Profile.swift +++ b/Kimis/Interface/Controller/UserController/UserProfileController/UserViewController+Profile.swift @@ -267,7 +267,9 @@ extension UserViewController.ProfileView { } func updateViewStatus() { - for view in subviews { view.isHidden = true } + for view in subviews { + view.isHidden = true + } bannerImageView.isHidden = false bannerImageBlur.isHidden = false avatarImageView.isHidden = false diff --git a/Kimis/Interface/Controller/UserController/UserProfileController/UserViewController+Update.swift b/Kimis/Interface/Controller/UserController/UserProfileController/UserViewController+Update.swift index f0140a5..1bfe971 100644 --- a/Kimis/Interface/Controller/UserController/UserProfileController/UserViewController+Update.swift +++ b/Kimis/Interface/Controller/UserController/UserProfileController/UserViewController+Update.swift @@ -48,11 +48,10 @@ extension UserViewController { } self.tableView.footerProgressWorkingJobs -= 1 } } - let type: Network.UserNoteFetchType - switch self.fetchEndpoint { - case .notes: type = .notes - case .notesWithReplies: type = .replies - case .media: type = .attachments + let type: Network.UserNoteFetchType = switch self.fetchEndpoint { + case .notes: .notes + case .notesWithReplies: .replies + case .media: .attachments } let notes = self.source?.req.requestForUserNotes( userHandler: profile.userId, diff --git a/Kimis/Interface/Routing/ControllerRouting.swift b/Kimis/Interface/Routing/ControllerRouting.swift index 87b90b1..9601459 100644 --- a/Kimis/Interface/Routing/ControllerRouting.swift +++ b/Kimis/Interface/Routing/ControllerRouting.swift @@ -19,12 +19,12 @@ enum ControllerRouting { func constructController() -> UIViewController { switch self { - case .post: return PostController() - case .user: return UserViewController() - case .me: return CurrentUserViewController() - case .note: return NoteViewController() - case .hashtag: return HashtagNoteController() - case .search: return SearchController() + case .post: PostController() + case .user: UserViewController() + case .me: CurrentUserViewController() + case .note: NoteViewController() + case .hashtag: HashtagNoteController() + case .search: SearchController() // @unknown default: // let cont = UIViewController() // cont.