Automattic / Gravatar-SDK-iOS

Gravatar SDK is a Swift library that allows you to integrate Gravatar features into your own iOS applications.
https://gravatar.com
Mozilla Public License 2.0
41 stars 5 forks source link

Fix extra dot separator with pronouns only model #220

Closed etoledom closed 6 months ago

etoledom commented 6 months ago

Closes #212

Description

This PR solves the issue of having an extra separator when there's just one personal info field in the model.

I propose a different approach, in which a separator is not a building blocks, but we add the separator in between building blocks using Array.joined() function.

In this way we don't need to worry about edge cases, and much of the code needed for checking such cases is not needed any more.

Users can still add a custom separator using:

public func content(
    _ model: PersonalInfoModel,
    lines: [PersonalInfoLine],
    separator: String?
) -> PersonalInfoBuilder

Testing Steps