Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
AppleLibs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Ullerich
AppleLibs
Commits
344b2ed3
Commit
344b2ed3
authored
3 years ago
by
Tobias Ullerich
Browse files
Options
Downloads
Patches
Plain Diff
Make TemplatedString public
parent
362e191d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AppleLibs/Utils/String/TemplatedString.swift
+7
-7
7 additions, 7 deletions
AppleLibs/Utils/String/TemplatedString.swift
with
7 additions
and
7 deletions
AppleLibs/Utils/String/TemplatedString.swift
+
7
−
7
View file @
344b2ed3
...
...
@@ -10,18 +10,18 @@
import
Foundation
@dynamicMemberLookup
struct
TemplatedString
public
struct
TemplatedString
{
var
template
:
String
public
var
template
:
String
private
var
data
:
[
String
:
String
]
var
evaluatedString
:
String
{
data
.
reduce
(
template
)
{
$0
.
replacingOccurrences
(
of
:
"${#
\(
$1
.
key
)
}"
,
with
:
$1
.
value
)
}
}
public
var
evaluatedString
:
String
{
data
.
reduce
(
template
)
{
$0
.
replacingOccurrences
(
of
:
"${#
\(
$1
.
key
)
}"
,
with
:
$1
.
value
)
}
}
init
(
template
:
String
,
data
:
[
String
:
String
]
=
[:])
{
public
init
(
template
:
String
,
data
:
[
String
:
String
]
=
[:])
{
self
.
template
=
template
self
.
data
=
data
}
subscript
(
dynamicMember
member
:
String
)
->
CustomStringConvertible
?
{
public
subscript
(
dynamicMember
member
:
String
)
->
CustomStringConvertible
?
{
get
{
data
[
member
]
}
...
...
@@ -30,7 +30,7 @@ struct TemplatedString
}
}
subscript
(
dynamicMember
member
:
String
)
->
Date
{
public
subscript
(
dynamicMember
member
:
String
)
->
Date
{
get
{
dateFormatter
.
date
(
from
:
data
[
member
]
??
""
)
??
Date
(
timeIntervalSince1970
:
0
)
}
...
...
@@ -39,7 +39,7 @@ struct TemplatedString
}
}
let
dateFormatter
:
DateFormatter
=
{
public
var
dateFormatter
:
DateFormatter
=
{
let
formatter
=
DateFormatter
()
formatter
.
dateFormat
=
"yyyy-MM-dd'T'HH:mm:ssZZZZZ"
formatter
.
calendar
=
Calendar
(
identifier
:
.
gregorian
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment