Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xx messenger iOS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
mobile
iOS
xx messenger iOS
Merge requests
!43
Created outline style for input field
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Created outline style for input field
new-input-field
into
sftp
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Bruno Muniz
requested to merge
new-input-field
into
sftp
2 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
sftp
version 2
15a046e7
2 years ago
version 1
15a046e7
2 years ago
sftp (base)
and
latest version
latest version
15a046e7
1 commit,
2 years ago
version 2
15a046e7
1 commit,
2 years ago
version 1
15a046e7
1 commit,
2 years ago
1 file
+
62
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Sources/InputField/OutlinedInputField.swift
0 → 100644
+
62
−
0
Options
import
UIKit
import
Shared
import
Combine
public
final
class
OutlinedInputField
:
UIView
{
let
textField
=
UITextField
()
let
placeholderLabel
=
UILabel
()
public
var
textPublisher
:
AnyPublisher
<
String
,
Never
>
{
textField
.
textPublisher
}
public
init
()
{
super
.
init
(
frame
:
.
zero
)
layer
.
borderWidth
=
1.0
layer
.
cornerRadius
=
4.0
layer
.
masksToBounds
=
true
layer
.
borderColor
=
Asset
.
neutralWeak
.
color
.
cgColor
textField
.
delegate
=
self
textField
.
backgroundColor
=
.
clear
placeholderLabel
.
textColor
=
Asset
.
neutralWeak
.
color
placeholderLabel
.
font
=
Fonts
.
Mulish
.
regular
.
font
(
size
:
16.0
)
addSubview
(
placeholderLabel
)
addSubview
(
textField
)
placeholderLabel
.
snp
.
makeConstraints
{
$0
.
top
.
equalToSuperview
()
.
offset
(
15
)
$0
.
left
.
equalToSuperview
()
.
offset
(
15
)
$0
.
right
.
lessThanOrEqualToSuperview
()
.
offset
(
-
15
)
$0
.
bottom
.
equalToSuperview
()
.
offset
(
-
18
)
}
textField
.
snp
.
makeConstraints
{
$0
.
top
.
equalToSuperview
()
.
offset
(
15
)
$0
.
left
.
equalToSuperview
()
.
offset
(
15
)
$0
.
right
.
equalToSuperview
()
.
offset
(
-
15
)
$0
.
bottom
.
equalToSuperview
()
.
offset
(
-
18
)
}
}
required
init
?(
coder
:
NSCoder
)
{
nil
}
public
func
setup
(
title
:
String
)
{
placeholderLabel
.
text
=
title
}
}
extension
OutlinedInputField
:
UITextFieldDelegate
{
public
func
textField
(
_
textField
:
UITextField
,
shouldChangeCharactersIn
range
:
NSRange
,
replacementString
string
:
String
)
->
Bool
{
placeholderLabel
.
alpha
=
(
textField
.
text
!
as
NSString
)
.
replacingCharacters
(
in
:
range
,
with
:
string
)
.
count
>
0
?
0.0
:
1.0
return
true
}
}
Loading