Skip to content

Commit

Permalink
Merge pull request #8 from iWECon/dev
Browse files Browse the repository at this point in the history
Update and fix some invalid code
  • Loading branch information
iWECon authored Jul 21, 2023
2 parents 15a169b + b7bbe54 commit 29b0d1c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 16 deletions.
7 changes: 6 additions & 1 deletion Sources/Segmenter/Segment/Info/+ImageInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ extension Segment {
var activeSize: CGSize
var inactiveSize: CGSize

init(activeImage: UIImage, inacitveImage: UIImage? = nil, activeSize: CGSize, inactiveSize: CGSize) {
init(
activeImage: UIImage,
inacitveImage: UIImage? = nil,
activeSize: CGSize,
inactiveSize: CGSize
) {
self.activeImage = activeImage
self.activeSize = activeSize
self.inactiveSize = inactiveSize
Expand Down
28 changes: 17 additions & 11 deletions Sources/Segmenter/Segment/Info/+LabelInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import UIKit

public protocol SegmentLabelInfoProvider: SegmentInfoProvider {
var title: String? { get }
var title: String { get }

var activeFont: UIFont? { get }
var activeColor: UIColor? { get }
var inactiveFont: UIFont? { get }
var inactiveColor: UIColor? { get }
var activeFont: UIFont { get }
var activeColor: UIColor { get }
var inactiveFont: UIFont { get }
var inactiveColor: UIColor { get }
}

// MARK:- LabelInfo
Expand All @@ -21,14 +21,20 @@ extension Segment {
Label.self
}

var title: String?
var title: String

var activeFont: UIFont?
var activeColor: UIColor?
var inactiveFont: UIFont?
var inactiveColor: UIColor?
var activeFont: UIFont
var activeColor: UIColor
var inactiveFont: UIFont
var inactiveColor: UIColor

init(title: String, activeFont: UIFont? = nil, activeColor: UIColor? = nil, inactiveFont: UIFont? = nil, inactiveColor: UIColor? = nil) {
init(
title: String,
activeFont: UIFont = .systemFont(ofSize: 22, weight: .medium),
activeColor: UIColor = .darkText,
inactiveFont: UIFont = .systemFont(ofSize: 16),
inactiveColor: UIColor = .darkGray
) {
self.title = title

self.activeFont = activeFont
Expand Down
7 changes: 6 additions & 1 deletion Sources/Segmenter/Segment/Info/+ViewInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ extension Segment {
var activeSize: CGSize
var inactiveSize: CGSize

init(activeView: UIView, inactiveView: UIView? = nil, activeSize: CGSize, inactiveSize: CGSize) {
init(
activeView: UIView,
inactiveView: UIView? = nil,
activeSize: CGSize,
inactiveSize: CGSize
) {
self.activeView = activeView
self.inactiveView = inactiveView

Expand Down
9 changes: 6 additions & 3 deletions Sources/Segmenter/Segment/Views/+Segment+Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ extension Segment {
return imageView
}

let viewInfo = _ViewInfo(activeView: makeImageView(info.activeImage)!,
inactiveView: makeImageView(info.inactiveImage),
activeSize: info.activeSize, inactiveSize: info.inactiveSize)
let viewInfo = _ViewInfo(
activeView: makeImageView(info.activeImage)!,
inactiveView: makeImageView(info.inactiveImage),
activeSize: info.activeSize,
inactiveSize: info.inactiveSize
)
super.init(Segment(kind: .view(viewInfo)), info: viewInfo)
}

Expand Down

0 comments on commit 29b0d1c

Please sign in to comment.