Skip to content

Commit

Permalink
Add methods for get image local
Browse files Browse the repository at this point in the history
  • Loading branch information
joaolfp committed Aug 22, 2023
1 parent 0e447e3 commit ccb993d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v1.5.2
18 changes: 18 additions & 0 deletions Sources/MagicImages/MagicImages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ public class MagicImages {
return self
}

/// Add the image local with name
/// - Parameter name: Image name
/// - Returns: Returns the method applied and activated
@discardableResult
public func start(name: String) -> Self {
image.image = UIImage(named: name)
return self
}

/// Add the image local with any type of UIImage
/// - Parameter uiImage: Variable type UIImage
/// - Returns: Returns the method applied and activated
@discardableResult
public func start(uiImage: UIImage?) -> Self {
image.image = uiImage
return self
}

/// Add the image circle
/// - Parameter measure: Corner Radius
/// - Returns: Returns the method applied and activated
Expand Down
18 changes: 18 additions & 0 deletions Tests/MagicImagesTests/MagicImagesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ final class MagicImagesTests: XCTestCase {
super.tearDown()
}

func testVerifyStartWithURL() {
let image = UIImageView()
MagicImages(image: image).start(url: "https://www.image.com/photo.png")
XCTAssertNotNil(image)
}

func testVerifyStartWithName() {
let image = UIImageView()
MagicImages(image: image).start(name: "photo")
XCTAssertNotNil(image)
}

func testVerifyStartWithUIImage() {
let image = UIImageView()
MagicImages(image: image).start(uiImage: UIImage())
XCTAssertNotNil(image)
}

func testVerifyIsCircleWithSuccess() {
let image = UIImageView()
MagicImages(image: image).start(url: "https://www.image.com/photo.png").isCircle(measure: 100)
Expand Down

0 comments on commit ccb993d

Please sign in to comment.