Skip to content

Commit

Permalink
Expose more items as public
Browse files Browse the repository at this point in the history
  • Loading branch information
igorcferreira committed Apr 5, 2022
1 parent 915d425 commit 4d11aa7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions Sources/domain/CGImageSourceFrameSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
import Foundation
import CoreImage

struct CGImageSourceFrameSequence: AsyncSequence {
typealias Element = ImageFrame
public struct CGImageSourceFrameSequence: AsyncSequence {
public typealias Element = ImageFrame

let source: CGImageSource
let loop: Bool
public let source: CGImageSource
public let loop: Bool

init(source: CGImageSource, loop: Bool) {
public init(source: CGImageSource, loop: Bool) {
self.source = source
self.loop = loop
}

func makeAsyncIterator() -> CGImageSourceIterator {
public func makeAsyncIterator() -> CGImageSourceIterator {
CGImageSourceIterator(source: source, loop: loop)
}
}
16 changes: 8 additions & 8 deletions Sources/domain/CGImageSourceIterator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
import Foundation
import CoreImage

struct CGImageSourceIterator: AsyncIteratorProtocol {
public struct CGImageSourceIterator: AsyncIteratorProtocol {

let loop: Bool
let frameCount: Int
let source: CGImageSource
var currentFrame: Int
public let loop: Bool
public let frameCount: Int
public let source: CGImageSource
public private(set) var currentFrame: Int

init(source: CGImageSource, loop: Bool) {
public init(source: CGImageSource, loop: Bool) {
self.source = source
self.frameCount = CGImageSourceGetCount(source)
self.currentFrame = 0
self.loop = loop
}

mutating func next() async throws -> ImageFrame? {
public mutating func next() async throws -> ImageFrame? {

if currentFrame >= frameCount {
if loop {
Expand All @@ -42,7 +42,7 @@ struct CGImageSourceIterator: AsyncIteratorProtocol {
return frame
}

mutating func reset() {
public mutating func reset() {
currentFrame = 0
}
}
2 changes: 1 addition & 1 deletion Sources/domain/ImageLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct ImageLoader {
self.fileManager = fileManager
}

func load(source: GIFSource, loop: Bool) async throws -> CGImageSourceFrameSequence {
public func load(source: GIFSource, loop: Bool) async throws -> CGImageSourceFrameSequence {
let data = try await source.loadData(session: session, cache: cache, fileManager: fileManager)
return try data.imageAsyncSequence(loop: loop)
}
Expand Down

0 comments on commit 4d11aa7

Please sign in to comment.