-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bec7b7f
Showing
181 changed files
with
5,489 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
/*.xcodeproj | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm/config/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
.netrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "combinex", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/lavalleeale/CombineX", | ||
"state" : { | ||
"branch" : "master", | ||
"revision" : "bb5ff98aff5db119c5a1075c63204fab3612a648" | ||
} | ||
}, | ||
{ | ||
"identity" : "cxshim", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/cx-org/CXShim", | ||
"state" : { | ||
"revision" : "82fecc246c7ca9f0ac1656b8199b7956e64d68f3", | ||
"version" : "0.4.0" | ||
} | ||
}, | ||
{ | ||
"identity" : "swift-atomics", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/apple/swift-atomics.git", | ||
"state" : { | ||
"revision" : "6c89474e62719ddcc1e9614989fff2f68208fe10", | ||
"version" : "1.1.0" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// swift-tools-version: 5.8 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "Swimmy", | ||
platforms: [.iOS(.v15), .macOS(.v13)], | ||
products: [ | ||
// Products define the executables and libraries a package produces, making them visible to other packages. | ||
.library( | ||
name: "Swimmy", | ||
targets: ["Swimmy"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/cx-org/CXShim", .upToNextMinor(from: "0.4.0")), | ||
.package(url: "https://github.com/lavalleeale/CombineX", branch: "master"), | ||
], | ||
targets: [ | ||
// Targets are the basic building blocks of a package, defining a module or a test suite. | ||
// Targets can depend on other targets in this package and products from dependencies. | ||
.target( | ||
name: "Swimmy", | ||
dependencies: [ | ||
.product(name: "CXShim", package: "CXShim"), | ||
.product(name: "CombineX", package: "CombineX"), | ||
], | ||
swiftSettings: [.enableUpcomingFeature("BareSlashRegexLiterals")] | ||
), | ||
.testTarget( | ||
name: "SwimmyTests", | ||
dependencies: ["Swimmy"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
// | ||
// APIExtensions.swift | ||
// | ||
// | ||
// Created by Dana Buehre on 11/9/23. | ||
// | ||
|
||
import Foundation | ||
|
||
//extension URL { | ||
// var isImageURL: Bool { | ||
// return absoluteString.isImageURL | ||
// } | ||
// | ||
// var isVideoURL: Bool { | ||
// return absoluteString.isVideoURL | ||
// } | ||
//} | ||
|
||
//extension String { | ||
// | ||
// var nilOrValue: String? { | ||
// guard !isEmpty else { | ||
// return nil | ||
// } | ||
// | ||
// return self | ||
// } | ||
// | ||
// | ||
// var isImageURL: Bool { | ||
// return self.range(of: "(http[^\\s]+(jpg|jpeg|png|gif|gifv|webp|bmp|apng)\\b)", options: [.regularExpression, .caseInsensitive]) != nil | ||
// } | ||
// | ||
// var isVideoURL: Bool { | ||
// return self.range(of: "(http[^\\s]+(avi|m4a|m4b|m4p|m4r|m4v|mov|mp4|mpa|mqv|webvtt|xhe|m3u8)\\b)", options: [.regularExpression, .caseInsensitive]) != nil | ||
// } | ||
// | ||
// func getURLs(filterBlock: @escaping (URL) -> Bool) -> (found: [URL], filtered: [URL]) { | ||
// var urls: [URL] = [] | ||
// var filtered: [URL] = [] | ||
// let types: NSTextCheckingResult.CheckingType = [ .link] | ||
// let detector = try? NSDataDetector(types: types.rawValue) | ||
// detector?.enumerateMatches(in: self, options: [], range: NSMakeRange(0, (self as NSString).length)) { (result, flags, _) in | ||
// if let url = result?.url, url.scheme != "mailto" { | ||
// if filterBlock(url) { | ||
// filtered.append(url) | ||
// } else { | ||
// urls.append(url) | ||
// } | ||
// } | ||
// } | ||
// return (urls, filtered) | ||
// } | ||
// | ||
// func getURLs(filter: String? = nil) -> (found: [URL], filtered: [URL]) { | ||
// var urls: [URL] = [] | ||
// var filtered: [URL] = [] | ||
// let types: NSTextCheckingResult.CheckingType = [ .link] | ||
// let detector = try? NSDataDetector(types: types.rawValue) | ||
// detector?.enumerateMatches(in: self, options: [], range: NSMakeRange(0, (self as NSString).length)) { (result, flags, _) in | ||
// if let url = result?.url, url.scheme != "mailto" { | ||
// if let filter = filter, url.absoluteString.contains(filter) { | ||
// filtered.append(url) | ||
// } else { | ||
// urls.append(url) | ||
// } | ||
// } | ||
// } | ||
// return (urls, filtered) | ||
// } | ||
// | ||
// func getUniqueURLs(filterBlock: @escaping (URL) -> Bool) -> (found: [URL], filtered: [URL]) { | ||
// let results = getURLs(filterBlock: filterBlock) | ||
// return (results.found.uniqued(), results.filtered.uniqued()) | ||
// } | ||
// | ||
// func getUniqueURLs(filter: String? = nil) -> (found: [URL], filtered: [URL]) { | ||
// let results = getURLs(filter: filter) | ||
// return (results.found.uniqued(), results.filtered.uniqued()) | ||
// } | ||
//} | ||
|
||
//extension Sequence where Element: Hashable { | ||
// func uniqued() -> [Element] { | ||
// var set = Set<Element>() | ||
// return filter { set.insert($0).inserted } | ||
// } | ||
//} | ||
|
||
//extension Post | ||
// var content: String? { | ||
// body ?? embed_description | ||
// } | ||
// | ||
// var local_url: URL { | ||
// AccountManager.shared.instanceURL.appending(path: "post/\(id)") | ||
// } | ||
// | ||
// public var imageURL: URL? { | ||
// let url = url?.asURL | ||
// return (url?.isImageURL ?? false) ? url : nil | ||
// } | ||
// | ||
// public var videoURL: URL? { | ||
// let url = url?.asURL | ||
// return (url?.isVideoURL ?? false) ? url : nil | ||
// } | ||
// | ||
// public var imageURLs: [URL]? { | ||
// var urls = body?.getUniqueURLs().found.compactMap{ $0.isImageURL ? $0 : nil } | ||
// if let url = imageURL { | ||
// urls?.append(url) | ||
// } | ||
// | ||
// return urls | ||
// } | ||
// | ||
// public var videoURLs: [URL]? { | ||
// var urls = body?.getUniqueURLs().found.compactMap{ $0.isVideoURL ? $0 : nil } | ||
// if let url = videoURL { | ||
// urls?.append(url) | ||
// } | ||
// | ||
// return urls | ||
// } | ||
//} | ||
// | ||
|
||
//extension Site { | ||
// var full_sidebar: String { | ||
// if let description = description?.nilOrValue, let sidebar = sidebar?.nilOrValue { | ||
// return "\(description)\n\n\(sidebar)" | ||
// } | ||
// if let description = description?.nilOrValue { | ||
// return description | ||
// } | ||
// if let sidebar = sidebar?.nilOrValue { | ||
// return sidebar | ||
// } | ||
// | ||
// return "" | ||
// } | ||
//} | ||
|
||
//extension Comment { | ||
// | ||
// var local_url: URL { | ||
// AccountManager.shared.instanceURL.appending(path: "comment/\(id)") | ||
// } | ||
// | ||
// var display_content: String { | ||
// deleted ? "*deleted by creator*" : | ||
// removed ? "*removed by mod*" : | ||
// content | ||
// } | ||
// | ||
// var parentId: Int? { | ||
// let components = path.components(separatedBy: ".") | ||
// | ||
// guard path != "0", components.count != 2 else { | ||
// return nil | ||
// } | ||
// | ||
// guard let id = components.dropLast(1).last else { | ||
// return nil | ||
// } | ||
// | ||
// return Int(id) | ||
// } | ||
// | ||
// var pathIds: [Int]? { | ||
// let components = path.components(separatedBy: ".").dropFirst() | ||
// return components.compactMap({ Int($0) }) | ||
// } | ||
// | ||
// var depth: Int { | ||
// let count = path.components(separatedBy: ".").count - 1 | ||
// return count >= 0 ? count : 0 | ||
// } | ||
// | ||
// var isTopLevel: Bool { | ||
// return depth < 2 | ||
// } | ||
//} | ||
|
||
//extension Community { | ||
// var community_instance_name: String { | ||
// return "\(name)@\(URL(string: actor_id)!.host!)" | ||
// } | ||
// | ||
// var instance_host: String { | ||
// return URL(string: actor_id)!.host! | ||
// } | ||
// | ||
// var local_url: URL { | ||
// AccountManager.shared.instanceURL.appending(path: "c/\(community_instance_name)") | ||
// } | ||
//} | ||
|
||
//extension Person { | ||
// var instance: String { | ||
// return "\(actor_id.asURL!.host!)" | ||
// } | ||
// | ||
// var full_username: String { | ||
// return "\(name)@\(actor_id.asURL!.host!)" | ||
// } | ||
// | ||
// var safe_display_name: String { | ||
// return (!(display_name?.isEmpty ?? true) ? display_name : nil) ?? name | ||
// } | ||
//} |
Oops, something went wrong.