Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Rename users in address book #870

Merged
merged 4 commits into from
Aug 18, 2023
Merged

Rename users in address book #870

merged 4 commits into from
Aug 18, 2023

Conversation

bfollington
Copy link
Collaborator

@bfollington bfollington commented Aug 11, 2023

Fixes #776

This is a quick way to implement to repurpose follow sheet for renaming users.

image image

@bfollington bfollington force-pushed the 2023-08-11-rename-user branch from ab44831 to e7ae1a5 Compare August 11, 2023 05:52
Copy link
Collaborator

@gordonbrander gordonbrander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small request. Otherwise LGTM.

@@ -359,6 +368,46 @@ private struct FollowModifier: ViewModifier {
}
}

private struct RenameModifier: ViewModifier {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that private here means "private to my project", not "private to this file".

  • Recommend moving this to a separate file, or into FollowUserSheet
  • Recommend giving it specific name, perhaps RenameSheetModifier

Copy link
Collaborator Author

@bfollington bfollington Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that private here means "private to my project", not "private to this file".

Based on my testing this isn't true, it means "private to the containing lexical scope" which in this case is the file. private at the root of a file is equivalent to fileprivate, no other file can access the type. internal means "internal to my project".

fileprivate is now what private used to be in earlier Swift releases: accessible from the same source file. A declaration marked as private can now only be accessed within the lexical scope it is declared in. So private is more restrictive than fileprivate.

https://stackoverflow.com/questions/39027250/what-is-a-good-example-to-differentiate-between-fileprivate-and-private-in-swift

See also: https://forums.swift.org/t/calling-private-methods-from-extensions-in-separate-files/54029

// A.swift

private struct One {}
fileprivate struct Two {}
internal struct Three {}
struct Four {} // implicitly `internal` by default
public struct Five {}
// B.swift

let one: One? = nil // Error: Cannot find 'One' in scope
let two: Two? = nil  // Error: Cannot find 'Two' in scope
let three: Three? = nil
let four: Four? = nil
let five: Five? = nil

Copy link
Collaborator Author

@bfollington bfollington Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved all these sheets into UserProfileView+SheetModifier.swift and clarified the naming convention.

Copy link
Collaborator Author

@bfollington bfollington Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, when trying to use something marked as private at the file root the error says that it's actually fileprivate. I guess internally private at file root === fileprivate.

image

@bfollington bfollington force-pushed the 2023-08-11-rename-user branch from 3afd564 to 4d0b033 Compare August 14, 2023 04:36
Copy link
Collaborator

@gordonbrander gordonbrander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with a couple small requests.

@bfollington bfollington merged commit 1980083 into main Aug 18, 2023
@bfollington bfollington deleted the 2023-08-11-rename-user branch August 18, 2023 02:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to rename someone in my address book
2 participants