[CM-893] Renamed iconography to icon in code and unit test cases
This commit is contained in:
parent
852eba4057
commit
5aaea7c536
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// IconographyCategory.swift
|
// IconCategory.swift
|
||||||
//
|
//
|
||||||
// Created by Y Media Labs on 12/09/22.
|
// Created by Y Media Labs on 12/09/22.
|
||||||
//
|
//
|
||||||
|
@ -7,9 +7,9 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Category for images
|
/// Category for images
|
||||||
public struct IconographyCategory: Classification {
|
public struct IconCategory: Classification {
|
||||||
/// The type of View category supports
|
/// The type of View category supports
|
||||||
public typealias View = CatalogDisplayView<IconographyView>
|
public typealias View = CatalogDisplayView<IconView>
|
||||||
|
|
||||||
/// Name of the category
|
/// Name of the category
|
||||||
public let name: String
|
public let name: String
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// IconographyView.swift
|
// IconView.swift
|
||||||
//
|
//
|
||||||
// Created by Y Media Labs on 27/07/22.
|
// Created by Y Media Labs on 27/07/22.
|
||||||
//
|
//
|
||||||
|
@ -7,8 +7,8 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
/// A view to display a given image at a fixed size and ratio
|
/// A view to display a given image at a fixed size and ratio
|
||||||
final public class IconographyView: UIImageView {
|
final public class IconView: UIImageView {
|
||||||
/// The type of data required to populate the iconography view
|
/// The type of data required to populate the Icon view
|
||||||
public typealias Model = UIImage
|
public typealias Model = UIImage
|
||||||
|
|
||||||
private enum Style {
|
private enum Style {
|
||||||
|
@ -18,13 +18,13 @@ final public class IconographyView: UIImageView {
|
||||||
/// :nodoc:
|
/// :nodoc:
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
setUpIconographyView()
|
setUpIconView()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// :nodoc:
|
/// :nodoc:
|
||||||
public required init?(coder: NSCoder) { nil }
|
public required init?(coder: NSCoder) { nil }
|
||||||
|
|
||||||
private func setUpIconographyView() {
|
private func setUpIconView() {
|
||||||
contentMode = .scaleAspectFit
|
contentMode = .scaleAspectFit
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
self.widthAnchor.constraint(equalToConstant: Style.size.width),
|
self.widthAnchor.constraint(equalToConstant: Style.size.width),
|
||||||
|
@ -35,7 +35,7 @@ final public class IconographyView: UIImageView {
|
||||||
|
|
||||||
// MARK: - Populatable
|
// MARK: - Populatable
|
||||||
|
|
||||||
extension IconographyView: Populatable {
|
extension IconView: Populatable {
|
||||||
/// :nodoc:
|
/// :nodoc:
|
||||||
public func populate(with model: Model) {
|
public func populate(with model: Model) {
|
||||||
self.image = model
|
self.image = model
|
||||||
|
@ -44,7 +44,7 @@ extension IconographyView: Populatable {
|
||||||
|
|
||||||
// MARK: - Reusable
|
// MARK: - Reusable
|
||||||
|
|
||||||
extension IconographyView: Reusable {
|
extension IconView: Reusable {
|
||||||
/// :nodoc:
|
/// :nodoc:
|
||||||
public func prepareForReuse() {
|
public func prepareForReuse() {
|
||||||
self.image = nil
|
self.image = nil
|
|
@ -8,15 +8,15 @@ import XCTest
|
||||||
@testable import YCatalogViewer
|
@testable import YCatalogViewer
|
||||||
|
|
||||||
final class CategoriesTest: XCTestCase {
|
final class CategoriesTest: XCTestCase {
|
||||||
func testIconographyCategory() {
|
func testIconCategory() {
|
||||||
let model = [
|
let model = [
|
||||||
CatalogDisplayView<IconographyView>.Model(
|
CatalogDisplayView<IconView>.Model(
|
||||||
title: "title1",
|
title: "title1",
|
||||||
detail: "detail1",
|
detail: "detail1",
|
||||||
model: UIImage(systemName: "person.fill") ?? UIImage()
|
model: UIImage(systemName: "person.fill") ?? UIImage()
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
let category = IconographyCategory(name: "Icons", models: model)
|
let category = IconCategory(name: "Icons", models: model)
|
||||||
XCTAssertEqual(category.name, category.destination.navigationTitle)
|
XCTAssertEqual(category.name, category.destination.navigationTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// IconographyViewTest.swift
|
// IconViewTest.swift
|
||||||
//
|
//
|
||||||
// Created by Y Media Labs on 01/08/22.
|
// Created by Y Media Labs on 01/08/22.
|
||||||
//
|
//
|
||||||
|
@ -7,9 +7,9 @@
|
||||||
import XCTest
|
import XCTest
|
||||||
@testable import YCatalogViewer
|
@testable import YCatalogViewer
|
||||||
|
|
||||||
final class IconographyViewTest: XCTestCase {
|
final class IconViewTest: XCTestCase {
|
||||||
func testInitWithCoder() throws {
|
func testInitWithCoder() throws {
|
||||||
let sut = IconographyView(coder: try makeCoder(for: makeSUT()))
|
let sut = IconView(coder: try makeCoder(for: makeSUT()))
|
||||||
XCTAssertNil(sut)
|
XCTAssertNil(sut)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ final class IconographyViewTest: XCTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private extension IconographyViewTest {
|
private extension IconViewTest {
|
||||||
func makeSUT(file: StaticString = #filePath, line: UInt = #line) -> IconographyView {
|
func makeSUT(file: StaticString = #filePath, line: UInt = #line) -> IconView {
|
||||||
let sut = IconographyView(frame: .zero)
|
let sut = IconView(frame: .zero)
|
||||||
trackForMemoryLeak(sut, file: file, line: line)
|
trackForMemoryLeak(sut, file: file, line: line)
|
||||||
return sut
|
return sut
|
||||||
}
|
}
|
Loading…
Reference in New Issue