Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help please #22

Closed
KBMatveev opened this issue Dec 12, 2016 · 25 comments
Closed

Help please #22

KBMatveev opened this issue Dec 12, 2016 · 25 comments

Comments

@KBMatveev
Copy link

Then use - let someString = String(" 123 ").trimmed
have error - Value of type "String?" has no member 'trimmed'

Why?

@omaralbeik
Copy link
Member

@KBMatveev did you add "import SwifterSwift" to the top of the file?

@KBMatveev
Copy link
Author

KBMatveev commented Dec 12, 2016

No. But let today = Date().beginning(of: .day)! work without import. And startDate = today.adding(.year, value: -1) too

And then I write let someString = String(" 123 ").trimmed Xcode not found error. Xcode found error then I try build application

@omaralbeik
Copy link
Member

@KBMatveev some time some extensions don't work without import, please import SwifterSwift at every file you want to use it in, and let me know if you still have the problem

@KBMatveev
Copy link
Author

import SwifterSwift - No Such module 'SwifterSwift'
I add directory 'Extensions' manually.

"Manually
Add the extensions folder to your Xcode project to use all extensions, or a specific extension."

@omaralbeik
Copy link
Member

@KBMatveev and if you didn't clean and rebuild the project from the "Product" menu after installing the pod, it's also preferred to do that

@omaralbeik
Copy link
Member

@KBMatveev Then please make sure to check "Copy items if needed" and "Add to targets" checkboxes when adding the files to your xcode project

@KBMatveev
Copy link
Author

2016-12-12 10 58 42

Not work. In edit mode XCode found and show trimmed extension

2016-12-12 11 00 49

When build - error

2016-12-12 11 01 36

@omaralbeik
Copy link
Member

omaralbeik commented Dec 12, 2016

@KBMatveev I think the code should be
let someString = String(" 123 ")?.trimmed
or
let someString = String(" 123 ")!.trimmed

trimmed is a String extension not a String? extension
Please try adding ? or ! and let me know if this fixes the problem

@KBMatveev
Copy link
Author

Not work
2016-12-12 11 05 45

@omaralbeik
Copy link
Member

omaralbeik commented Dec 12, 2016

@KBMatveev 🤔, are you using xcode 8 with swift 3?
if yes, could you please try isEmail, or any other method to see if the problem is about the entire swift extensions, or just trimmed

@KBMatveev
Copy link
Author

Of course. :-)
2016-12-12 11 16 27

@KBMatveev
Copy link
Author

KBMatveev commented Dec 12, 2016

DateExtensions work good, UITableViewExtensions too, trouble only with StringExtensions

@omaralbeik
Copy link
Member

@KBMatveev Then I assume the StringExtensions.swift file is not added to the target, could you please delete it, and re-add it to project while making sure to add it to target and copy if needed viewcontroller_swift

@KBMatveev
Copy link
Author

I add the entire directory "Extensions", so it is unlikely that some files were added as DateExtensions, and some do not. But it's good. Will make again.
2016-12-12 11 27 15
2016-12-12 11 28 58
2016-12-12 11 30 03

@KBMatveev
Copy link
Author

2016-12-12 11 32 35

@omaralbeik
Copy link
Member

@KBMatveev weird!! , the StringExtensions.swift file follows the same structure of all other extensions files, and it is public

is this code working for you?
let someString = String(" 123 ")!.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)

@omaralbeik
Copy link
Member

@KBMatveev I'm trying to understand what is causing the problem in your end, I've tested this with multiple projects, as I see in the first picture you sent the autocompletion is completing the trimmed for you, which means xcode can see the file!
do you have another string method or property called trimmed somewhere else in your project?

@KBMatveev
Copy link
Author

Yes. Look second string.
2016-12-12 11 38 31
Had to pull it out Stringextension. Works.
Must be let rt = region.trimmed

@omaralbeik
Copy link
Member

@KBMatveev is the problem solved ?

@KBMatveev
Copy link
Author

do you have another string method or property called trimmed somewhere else in your project?

I have not tried everything. Reverse() does not work.
2016-12-12 11 43 41
2016-12-12 11 44 06

@omaralbeik
Copy link
Member

omaralbeik commented Dec 12, 2016

@KBMatveev I don't know what is happening in your end, everything is working correctly for me, I'd be glad to check it myself with teamviewer if you want
you can send me login info to omaralbeik@gmail.com

@KBMatveev
Copy link
Author

is the problem solved ?

I replaced trimmed on trimmingCharacters. It worked, but hardly a solution to the problem.

You want to connect via TeamViewer?

@omaralbeik
Copy link
Member

@KBMatveev I'll try to check what is causing the problem if you want via teamviewer

@KBMatveev
Copy link
Author

Send password via eMail

@omaralbeik
Copy link
Member

@KBMatveev Glad your problem is fixed, I think the problem is when adding files from the file menu, they didn't get added to target for some reason, dragging the files to the project, always shows you the confirmation menu, where you can double check that files are added to your target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants