diff --git a/ApplicationLibrary/LubyTransform/EncodedBlock.swift b/ApplicationLibrary/LubyTransform/EncodedBlock.swift index 790b583..63802f6 100644 --- a/ApplicationLibrary/LubyTransform/EncodedBlock.swift +++ b/ApplicationLibrary/LubyTransform/EncodedBlock.swift @@ -8,7 +8,7 @@ struct EncodedBlock { let bytes: Int let checksum: UInt32 - // Binary format: degree(4) + indices(4*n) + k(4) + bytes(4) + checksum(4) + data + /// Binary format: degree(4) + indices(4*n) + k(4) + bytes(4) + checksum(4) + data func toBinary() -> Data { var result = Data() diff --git a/ApplicationLibrary/LubyTransform/LubyTransformDecoder.swift b/ApplicationLibrary/LubyTransform/LubyTransformDecoder.swift index 25286fb..2c3c62b 100644 --- a/ApplicationLibrary/LubyTransform/LubyTransformDecoder.swift +++ b/ApplicationLibrary/LubyTransform/LubyTransformDecoder.swift @@ -12,19 +12,26 @@ final class LubyTransformDecoder { private var disposedEncodedBlocks: [Int: [() -> Void]] = [:] private(set) var meta: EncodedBlock? - var k: Int { meta?.k ?? 0 } + var k: Int { + meta?.k ?? 0 + } + var progress: Double { guard k > 0 else { return 0 } return Double(decodedCount) / Double(k) } - var isComplete: Bool { meta != nil && decodedCount == k } + var isComplete: Bool { + meta != nil && decodedCount == k + } private class BlockWrapper: Hashable { var block: EncodedBlock let id = UUID() - init(_ block: EncodedBlock) { self.block = block } + init(_ block: EncodedBlock) { + self.block = block + } static func == (lhs: BlockWrapper, rhs: BlockWrapper) -> Bool { lhs.id == rhs.id diff --git a/ApplicationLibrary/LubyTransform/LubyTransformEncoder.swift b/ApplicationLibrary/LubyTransform/LubyTransformEncoder.swift index 14eb14f..931f2d6 100644 --- a/ApplicationLibrary/LubyTransform/LubyTransformEncoder.swift +++ b/ApplicationLibrary/LubyTransform/LubyTransformEncoder.swift @@ -92,7 +92,7 @@ final class LubyTransformEncoder { ) } - // Ideal Soliton Distribution for degree selection + /// Ideal Soliton Distribution for degree selection private func getRandomDegree() -> Int { guard k > 1 else { return k } var probabilities = [Double](repeating: 0, count: k) diff --git a/ApplicationLibrary/Views/Abstract/AlertState.swift b/ApplicationLibrary/Views/Abstract/AlertState.swift index ca63d9d..354e918 100644 --- a/ApplicationLibrary/Views/Abstract/AlertState.swift +++ b/ApplicationLibrary/Views/Abstract/AlertState.swift @@ -3,7 +3,6 @@ import Library import SwiftUI public extension View { - @ViewBuilder func alert(_ binding: Binding, isLoading: Binding) -> some View { alert( binding.wrappedValue?.title ?? "", diff --git a/ApplicationLibrary/Views/Abstract/DeleteButton.swift b/ApplicationLibrary/Views/Abstract/DeleteButton.swift index 746f8c1..d71544d 100644 --- a/ApplicationLibrary/Views/Abstract/DeleteButton.swift +++ b/ApplicationLibrary/Views/Abstract/DeleteButton.swift @@ -1,7 +1,7 @@ import Foundation import SwiftUI -public struct DeleteButton