Social inventory: Messages, Conversation, Notifications, Profile and shared components
Source of truth: DevPlaceIOS/DevPlaceIOS/UI/ (read-only reference). All paths below are relative to /home/retoor/projects/DevPlaceIOS/DevPlaceIOS/ unless prefixed SDK: (= /home/retoor/projects/DevPlaceIOS/DevPlaceSwiftSDK/Sources/DevPlaceSwiftSDK/). Citations are file:line. UI/ is abbreviated U/. Nothing here was measured on a running device: values come from reading source. Items that depend on Apple framework internals (Dynamic Type sizes, relative-date wording) are marked UNVERIFIED.
Conventions used in this document:
- "pt" = SwiftUI point. Fonts without explicit size use iOS system text styles at default Dynamic Type (Large): body 17 regular, headline 17 semibold, subheadline 15 regular, footnote 13 regular, caption 12 regular, caption2 11 regular. UNVERIFIED against a device, these are Apple's published default table.
@ScaledMetric scalemultiplies by the Dynamic Type factor; at default size scale = 1.0.- Colors are named tokens (section 1). Divider = 1 physical pixel system separator line, color iOS
separator. - All user-visible strings are quoted verbatim. The ellipsis in
Type a message…,https://…is U+2026.
1. Design tokens used everywhere
1.1 Color tokens (Assets.xcassets colorsets)
Source: Assets.xcassets/<name>.colorset/Contents.json. Components sRGB 0..1.
| Token | Light | Dark |
|---|---|---|
| BG_0 (BG0) | 1.000, 1.000, 1.000 (#FFFFFF) | 0,0,0 (#000000) |
| BG_1 (BG1) | 0.954, 0.941, 1.000 (~#F3F0FF) | 0.029, 0.016, 0.071 (~#070412) |
| BG_2 (BG2) | 0.913, 0.880, 1.000 (~#E9E0FF) | 0.096, 0.064, 0.181 (~#18102E) |
| FG_1 (FG1) | 0.029, 0.016, 0.071 (~#070412) | 0.953, 0.934, 0.980 (~#F3EEFA) |
| FG_2 (FG2) | 0.202, 0.134, 0.380 (~#342261) | 0.711, 0.661, 0.804 (~#B5A9CD) |
| AFG | 1,1,1 white (text on accent), no dark variant | same |
| AccentColor | 0.930, 0.456, 0.272 (~#ED7445) | same (no dark variant) |
| agStart (AGStart) | 0.930, 0.449, 0.302 (~#ED734D) | same |
| agEnd (AGEnd) | 0.925, 0.370, 0.429 (~#EC5E6D) | same |
Usage: BG_2 = screen background; BG_1 = card/box/bubble-other background; BG_0 = text-field fill in the chat composer. FG_1 primary text, FG_2 secondary text. Color.accentColor = AccentColor token.
1.2 Screen style modifier
U/Style/Screen/ScreenStyleModifier.swift:3-28. .screenStyle(bgColor: = BG_2, fgColor: = FG_1): fills background with bgColor ignoring safe area (line 10), sets foreground style FG_1 (line 12). Messages, Conversation, Notifications use bgColor: .BG_2 explicitly; Profile uses default (also BG_2).
1.3 AccentGradientButtonStyle
U/Style/ButtonStyles/AccentGradientButtonStyle.swift:3-49.
- Shapes:
roundedRectangle(default, corner radius 14, line 36) orcircle(line 38). - Label: font weight semibold (13), padding horizontal 16, vertical 12 (14-15), foreground
AFG(28). - Background: shape filled with linear gradient
[agStart, agEnd]from topLeading to bottomTrailing (19-23); opacity 0.7 when pressed else 1.0 (25); shadow color accent at 0.5 opacity, radius 5, no offset (26). - Pressed: scale 0.95 (29). No explicit animation modifier (SwiftUI default implicit).
- API:
.buttonStyle(.accentGradient)and.buttonStyle(.accentGradient(shape: .circle))(43-49). - Circle button size results from label (icon ~17pt plus padding 16 h / 12 v, shape Circle takes the larger-side frame of the padded label, so approx 17+32 wide by 17+24 tall; circle is drawn as the ellipse fill of the label frame, UNVERIFIED that it is square).
1.4 FormButtonStyle
U/Style/ButtonStyles/FormButtonStyle.swift:3-17. Label stretched maxWidth: .infinity, alignment: .leading, content shape Rectangle, foreground Color.gray while pressed else FG_1. Not used by the screens in this document.
1.5 DevPlaceTextFieldStyle
U/Style/TextFieldStyles/DevPlaceTextFieldStyle.swift:3-24. Wraps the field in BoxView(backgroundColor: <param, default BG_1>, borderOpacity: 0.5, cornerSize: .big (14), paddingSize: .small (10)). API .textFieldStyle(.devPlace) / .devPlace(backgroundColor:).
1.6 MarkdownTheme .devPlace
U/Style/MarkdownTheme.swift:4-38 (MarkdownUI library; base is empty Theme(), so body text, headings, lists, links use the MarkdownUI/system defaults, UNVERIFIED exact sizes). Overrides:
- inline code (6-10): monospaced, font size 0.85 em, background BG_2.
- blockquote (11-22): HStack spacing 0: a RoundedRectangle radius 6 filled FG_2 with width 0.2 em; label text colored FG_2, horizontal padding 1 em; whole thing
fixedSize(horizontal:false, vertical:true). - code block (23-38): horizontal ScrollView; label monospaced 0.85 em, line spacing 0.225 em, padding vertical 6 horizontal 10; background BG_2; clip radius 8; margins top 6 bottom 16.
1.7 AlertMessage (all error alerts)
U/Util/AlertMessage.swift. Structure {isPresented, title, message, buttonText}.
presentedError(message:)(18-20): titleError, buttonOK.presentedError(_ error)(22-69): CancellationError (also nested) = no alert.DevPlaceError-> its.message. API error: ifapiError.isSpecificmessage is server text; else"(<status>) <message>"(43-47). OtherslocalizedDescription.presentedMessage(_)(71-73): empty title,OK.- View
.alert(Binding<AlertMessage>)(77-90): standard alert, single button with role cancel labeledbuttonText, message text body.
1.8 Limits (SDK constants)
SDK:DevPlaceConstants.swift: maxDirectMessageLength = 2_000, maxAttachmentsCount = 10. Character count = text.utf16.count (Util/TextCharacterCounter.swift:3), i.e. UTF-16 code units, an emoji counts 2 or more.
2. BoxView
U/Components/BoxView.swift:3-56.
Parameters and defaults: backgroundColor BG_2, foregroundColor FG_1, borderColor FG_2, borderOpacity 0.25, borderWidth 1, cornerSize .normal, paddingSize .normal.
- Corner radius: small 10, normal 12, big 14 (9-15). Padding: none 0, small 10, normal 12, big 16 (24-31).
- Render order (43-55): content, foreground style, uniform padding, overlay = RoundedRectangle(cornerRadius)
strokeBorder(borderColor.opacity(borderOpacity), lineWidth 1)(inset stroke, drawn inside the shape), background = same rounded rect filled backgroundColor. - Used as list card (
BG_1, padding none) in Messages and Notifications.
3. RelativeTimeLabel
U/Components/RelativeTimeLabel.swift:3-13. Text(date, format: .relative(presentation: .named, unitsStyle: .narrow)), font system 12 * scale regular, color FG_2.
Exact relative-time rules (UNVERIFIED on device; this is Foundation Date.RelativeFormatStyle en_US behavior, CLDR data):
- presentation
.namedprefers named words where CLDR has them ("now", "yesterday", "tomorrow", "last week/wk.", "last month/mo.", "last year/yr.", "next ..."). - unitsStyle
.narrowabbreviates the unit: sec., min., hr., day(s), wk., mo., yr. - Unit selection: Foundation picks the largest unit whose rounded magnitude is >= 1 (seconds < 1 min, minutes < 1 h, hours < 1 day, days < 7 (named "yesterday" at 1), weeks, months, years), value rounded toward nearest.
- Expected output for the preview offsets (
U/Components/RelativeTimeLabel.swift:17-21): -30 s -> "30 sec. ago"; -13 min -> "13 min. ago"; -2 h -> "2 hr. ago"; -24 h -> "yesterday"; -7 d -> "last wk." (or "1 wk. ago"). For future dates "in N min." forms. Sub-second -> "now". - The C++ port must implement this table itself; verify wording on a real iOS device before freezing (no measurement exists).
The Conversations list uses a different style: .relative(presentation: .named, unitsStyle: .wide) (U/Screens/Messages/MessagesView.swift:122), giving "5 minutes ago", "2 hours ago", "yesterday", "now" (UNVERIFIED).
4. CapsuleLabel
U/Components/CapsuleLabel.swift:3-19. Text uppercased (11), font system 12scale weight medium (12), foreground default FG_1 (5), padding horizontal 8scale vertical 3*scale (14-15), background Capsule filled backgroundColor default gray.opacity(0.5) (6, 16-18).
5. UserImage (avatar), AsyncSVGImage, avatar URL scheme
U/Components/UserImage.swift:4-51.
- Avatar seed:
user.avatarSeed ?? user.username(11); alsoinit(seed:size:)(15-18). - URL:
"https://devplace.net/avatar/multiavatar/\(seed)"(21). The server returns an SVG (multiavatar). No percent-encoding is applied beyondURL(string:)(a nil URL = no load, placeholder forever). - View:
AsyncSVGImage(url) { image in image.resizable() } placeholder: { ZStack { Circle().foregroundStyle(BG_1); ProgressView() } }(23-32), framesize.points * scalesquare (33). - Sizes (38-50): small 30, normal 42 (default), large 100. Scale = ScaledMetric (Dynamic Type).
- No circular clip on the loaded image: the multiavatar SVG itself is round-ish artwork; only the placeholder is a Circle.
5.1 AsyncSVGImage
U/Components/Media/AsyncSVGImage.swift:28-186 (third-party gist by Oliver Atkinson / Erez Hod).
- State
uiImage: UIImage?(33). Body (65-77):content(Image(uiImage: uiImage ?? UIImage()))with overlayplaceholderat opacity 1 when uiImage nil else 0,.disabled(uiImage == nil);.onAppear { loadImageIfPossible() }. - Load (79-93):
URLSession.shared.data(from: url)(default cache policy, shared URLCache, no custom cache); on failure silently returns (placeholder stays, no retry). Decode with private CoreSVG framework (dlopen /System/Library/PrivateFrameworks/CoreSVG.framework/CoreSVG, 102-115, 117-135):CGSVGDocumentCreateFromData; rejects documents with canvas size zero (129). Render withUIGraphicsImageRenderer(size: svg.size)into UIImage at the SVG's intrinsic canvas size (88-91). - Draw (143-185): scale to fit preserving aspect (min of x,y ratios), center, flip Y (translate 0,h; scale 1,-1) then
CGContextDrawSVGDocument. - No in-memory image cache of its own: reloads on each
onAppear(every appearance, including list reuse). Port note: any SVG rasterizer (e.g. nanosvg/lunasvg) at intrinsic canvas size, scaled to frame; cache by seed in memory or disk to beat the iOS behavior.
6. UserAvatarView
U/Components/UserAvatarView.swift:4-24. HStack (default spacing ~8): UserImage(user, normal 42) then VStack(alignment .leading) (default spacing) containing a Group (lineLimit 1, maxWidth .infinity, alignment .leading): Text(user.username) semibold (14), Text("Level \(user.level)") caption 12, FG_2 (16-18). Used in PostHeaderView.
7. UserBadgeView
U/Components/UserBadgeView.swift:4-26. HStack(spacing 5): optional Text(badge.icon) and Text(badge.name) (each only if non-nil, 11-16). Font system 12*scale semibold (19), foreground accent (18), padding vertical 4 horizontal 8 (20-21), background Capsule foreground accent.opacity(0.2) (22-25).
8. VFlowStack (wrapping flow layout)
U/Components/VFlowStack.swift:3-100. Custom Layout; params alignment: HorizontalAlignment = .center, spacing: CGFloat? = nil (item and row spacing both = spacing ?? 8, lines 14, 30, 59).
- Measurement: each subview sized with
.unspecifiedproposal (natural size, 64). Rows built greedily (58-88): an item starts a new row if row not empty androwWidth + spacing + itemWidth > maxWidth. Row height = max item height; row width = sum widths + spacing*(n-1). - Container size (7-21): width = widest row; height = sum of row heights + spacing*(rows-1).
proposal.widthnil means infinity (single row). - Placement (23-56): rows stacked top to bottom,
y += rowHeight + spacing; row x offset:.leading0,.trailingbounds.width - rowWidth, otherwise (center)(bounds.width - rowWidth)/2; items placedtopLeadinganchor at their measured size,x += itemWidth + spacing. Items are top-aligned in a row (not centered vertically). - Used by Profile badges (alignment default center, spacing 8) and ReactionsStack.
9. SelectableTextPopover
U/Components/SelectableTextPopover.swift.
- Modifier
.selectableTextPopover(text)(4-8). AttachesonLongPressGesture(default minimum duration 0.5 s) to the content, setsisPresented(17-19), presents a popover (20-23) withpresentationCompactAdaptation(.popover)(stays a popover on iPhone instead of sheet). - Popover content (27-94):
VStack(alignment .leading, spacing 12)with padding 20: the selectable raw text view, then footer. Max content size 360 x 400 (35). - Raw text (132-178):
UITextViewnon-editable, selectable, clear bg, zero insets and lineFragmentPadding, fontpreferredFont(.body)(17), color FG_1, shows the raw markdown sourcemessage.data.content. Size: width = min(ideal single-line width, min(proposed width, 360)); height = min(fitted height at that width, min(proposed height, 400)) (157-177); scrolls beyond 400. - Footer (50-93):
HStackfont footnote (13), color FG_2, plain button style. Left groupHStack(spacing 16): icon-only buttonsSelect first word(SF Symbolselection.pin.in.out) andSelect all text(textformat.characters.arrow.left.and.right).Spacer. Right groupHStack(spacing 16):Copy to clipboard(document.on.clipboard, copies selection then dismisses), and only ifquoteComposer.isActive:Insert as quote(text.quote, inserts"> " + selectedText + "\n\n"then dismisses). Labels are accessibility labels only (icon-only). - selectedText (99-105): selected range text if non-empty selection, else whole text.
- selectFirstWord (107-116): becomeFirstResponder, regex
\S+first match range selected. selectAll (118-125): becomes first responder, selects whole document. copySelection (127-129):UIPasteboard.general.string = selectedText. - QuoteComposer (
U/Components/QuoteComposer.swift:3-17): environment value{isActive: Bool = false, insert: (String)->Void}; Conversation setsQuoteComposer(isActive: true) { viewModel.draft += $0 }(U/Screens/Conversation/ConversationView.swift:43-46), so the quote text is appended to the end of the draft.
10. DevPlaceTextEditor
U/Components/DevPlaceTextEditor.swift:3-191. Used by CreatePost and CommentEditor, not by the screens in this document, included for completeness.
- Params:
textbinding, optionalselectionbinding,placeholder"" default,sizeMode.resizable(default) or.fill,initialLineCount,animatesHeightChangesfalse,initialHeight,backgroundColorBG_1. - Container:
BoxView(backgroundColor, borderOpacity 0.5, cornerSize .big (14), paddingSize .none)(29-34). - Editor content (105-126): ZStack topLeading; when text empty, placeholder
Textcolor FG_2 at 0.5 opacity, padding vertical 8 horizontal 5, not hit-testable (107-113); systemTextEditorwithscrollContentBackground(.hidden)(115-122); whole ZStack padding horizontal 5 vertical 2. - Sizing:
.fill= maxWidth/maxHeight infinity topLeading (62-68)..resizable= fixed heightresolvedHeight(70-76): before first measurement useinitialHeight, else if animatesHeightChanges the estimatelines * 21 (ScaledMetric relativeTo body) + 20(92-98), elsemax(singleLineHeight, height)(89). Height animation.smooth(duration 0.25)only when animatesHeightChanges and not dragging (100-103). - Height measurement (159-190): hidden ZStack of two
Textmeasuring views (padding horizontal 10 vertical 10, maxWidth infinity leading, fixedSize vertical): one withinitialMeasurementString(n-1 newlines forinitialLineCount, else " " if empty, else current text) published as ContentHeightKey (first non-zero value initializesheight, once, 50-54), one with " " published as LineHeightKey = minimum height (55-57). - Resize grip (resizable only, 44-48, 128-134, 193-204): bottom-trailing overlay, 10x10 frame, padding 8, two diagonal strokes (lines from
(maxX, minY+step*k)to(minX+step*k, maxY), step = width/3, k=1,2), stroke FG_2 at 0.7 opacity, width 1.5, round cap, no hit testing. - Resize gesture (136-150): DragGesture in named coordinate space; starts only if
startLocation.y >= currentHeight - 24(bottom 24 pt band), then height =max(singleLineHeight, startHeight + translation.y); ends clears the drag. Applied as simultaneous gesture including all (resizable) or subviews only (fill).
11. Messages screen (conversation list)
Files: U/Screens/Messages/MessagesView.swift, U/Screens/Messages/MessagesView+ViewModel.swift. Entry: MainView tab (U/Screens/Main/MainView.swift:80).
11.1 Chrome
- Navigation title
Messages(MessagesView.swift:20). Background BG_2 via screenStyle (19). - Toolbar top-bar trailing (26-30, 91-102): while
isReloadingaProgressView(spinner) else aButtonwith icon-only labelReload, SF Symbolarrow.clockwise; actionTask { await viewModel.reload() }. - Pull to refresh (31-33):
await viewModel.reload(). - Navigation destination for
User(21-24): pushesConversationView(otherUser), with.id(otherUser.id).
11.2 Layout tree
ScrollView (45):
- Empty branch (46-49):
emptyState()frame(maxWidth .infinity)padding(.top, 80). - Non-empty (51-68):
LazyVStack(spacing 0)with.padding()(16 all sides) containingBoxView(backgroundColor BG_1, paddingSize .none)containingVStack(spacing 0)clippedRoundedRectangle(cornerRadius 12)(65). Each conversation =NavigationLink(value: conversation.otherUser)with.buttonStyle(.plain), with aDivider()after every row except the last (60-62; compares by otherUser.id).
11.3 ConversationRow (105-148)
HStack(alignment .top, spacing 10), padding 12 on all sides, background accentColor.opacity(0.08) if unread else clear (146), contentShape(Rectangle) (whole row tappable):
UserImage(user: otherUser)normal 42 (110).VStack(alignment .leading, spacing 4):HStack(alignment .firstTextBaseline):Text(username)semibold (17 body), FG_1;Spacer(minLength 8); time text caption (12) FG_2: iflastMessageDateparses ->.relative(.named, .wide)of that date, else the rawlastMessageAtstring (120-129).Text(lastMessage)subheadline (15), FG_2, lineLimit 1, maxWidth infinity leading (131-135). Raw text, markdown not rendered.
- If
unread(138-143):Circlefilled accentColor 8x8,padding(.top, 6).
11.4 Date parsing
MessagesView.swift:151-168: tries two ISO8601DateFormatter: first [.withInternetDateTime, .withFractionalSeconds], then [.withInternetDateTime]; first success wins; none -> nil -> raw string shown.
11.5 States
- Not logged in (74-79):
ContentUnavailableViewtitleSign in required, symbolbubble.left.and.bubble.right, descriptionSign in from the Settings tab to see your messages. - Logged in,
inbox == nil(80-81): centeredProgressView(loading). - Logged in, inbox loaded, zero conversations (83-87):
No conversations, same symbol, descriptionYour direct messages will appear here. - Error: alert (section 1.7) via
alertMessage(25); no inline error state; the list keeps the old data. - ContentUnavailableView = centered icon (large, secondary), title (headline-ish 20 semibold), description (secondary), vertically at top + 80 pt.
11.6 Data and actions
load()(+ViewModel.swift:196-207): if not logged in ->inbox = nil, return. Elseapi.messages()=GET https://devplace.net/messages(no params;SDK:DevPlaceSwiftSDK.swift:491-498, auth token), store inbox, thenAppState.loadUnreadCounts(GET notifications/counts, sets unread notification and message counts and app icon badge,AppState.swift:35-43). Error -> alert.reload()(209-223): same but guarded byisReloading(re-entrancy), setsisReloadingtrue then false (defer).- Triggers:
.taskon appear (39-41) runsload();onChange(appState.isLoggedIn)runsload()(34-38). No websocket on this screen; the list refreshes only on appear, pull-to-refresh, reload button, login change. - Tap row: navigation push to Conversation.
12. Conversation screen
Files: U/Screens/Conversation/ConversationView.swift, ConversationView+ViewModel.swift.
12.1 Chrome
- Title = other user's
username, inline display mode (48-49). Background BG_2. - Trailing toolbar reload (51-55, 233-244): spinner while
isReloadingelse icon-onlyReloadbutton (arrow.clockwise). - Alert binding (50).
- Lifecycle (56-76):
.task->load()thenstartRealtime()..onDisappear->stopRealtime()anddeleteUnsubmittedAttachments().scenePhasechange:.active->load()+startRealtime(); any other phase ->stopRealtime().onChange(draft)->userIsTyping().
12.2 Layout tree
VStack(spacing 0) (38): messages() then composer().
messages() (79-135): ScrollView containing VStack(spacing 12) of MessageBubbleView(message, maxBubbleWidth) each .id(message.id); the VStack frame(maxWidth .infinity), padding(.horizontal 12) and padding(.vertical 16) (81-89). Modifiers:
scrollPosition($scrollPosition)with initialScrollPosition(edge: .bottom)(21, 91),defaultScrollAnchor(.bottom)(92),scrollDismissesKeyboard(.interactively)(93), simultaneous TapGesture clears input focus (94-98).- Width tracking (99-103):
scrollViewWidth= scroll view width. Bubble max width (32-35): if width unknown 300 elsemax(scrollViewWidth - 12*2 - 48, 120)(insets 12, opposite-edge gap 48 at lines 29-30). - At-bottom tracking (104-109):
distanceFromBottom = contentSize.height - contentInsets.top - containerSize.height - contentOffset.y;isAtBottom = distanceFromBottom <= 80. - Auto-scroll (110-116): whenever content height changes and
isAtBottomis true,scrollToBottom(animated: false)(new messages, keyboard resize, image loads keep pinned). - Overlay bottom center (117-126): when
isOtherTyping,TypingIndicatorView(username)withpadding(.bottom 8), transition opacity; wrapper animation.snappy(about 0.35 s, UNVERIFIED) keyed onisOtherTyping. - Overlay bottom trailing (127-134, 147-157): when
!isAtBottom, button icon-onlyScroll to latest(chevron.down), style.accentGradient(shape: .circle),.padding()(16), transitionscale + opacity, animation.snappyonisAtBottom. Tap ->withAnimation { scrollPosition.scrollTo(edge: .bottom) }(137-145; default animation).
12.3 Composer (159-211)
Outer VStack(alignment .leading, spacing 4), padding horizontal 12 vertical 8, background BG_1 ignoring safe area (205-207), overlay top alignment Divider() (208-210).
Row 1: HStack(alignment: .composerInput (custom, bottom-based), spacing 8) (161):
- Left
VStack(alignment .leading, spacing 4):TextField("Type a message…", text: $draft, axis: .vertical),lineLimit(1...6)(grows to 6 lines then scrolls),textFieldStyle(.devPlace(backgroundColor: .BG_0))(box radius 14, padding 10, border FG_2 at 0.5), focus stateisInputFocused, custom alignment guide = bottom (163-167).HStack(spacing 8)padding horizontal 10 (169-187):CharacterCounterView(text draft, minCount, max 2000); if no attachments:Spacer(minLength 0)+ smallAttachmentUploaderView(isSmall: true ...).id(attachmentsResetToken)(176-185).
- Right:
sendButton()(213-231):Buttonlabel:ProgressViewwhileisSendingelse icon-onlySend message(paperplane.fill); style.accentGradient(shape: .circle);disabled(!canSend); opacity 0.4 when cannot send else 1. Row 2 (193-201): if attachments non-empty: fullAttachmentUploaderView(non-small, a BoxView list)frame(maxWidth .infinity, alignment .leading),padding(.top 4).
CharacterCounterView (U/Components/CharacterCounterView.swift:3-23): text "<count>/<max>" using Int.formatted() (locale grouping, e.g. 2,000 in en_US), font system 12*scale monospaced, FG_2 overall; the count part colored red when invalid (count < minCount or count > max) else FG_2.
12.4 Validation
minCharacterCount= 1 if no attachments else 0 (+ViewModel.swift:298-300).canSend(302-306): not sending ANDutf16 count >= minAND<= 2000. Whitespace-only text is allowed (count based only; no trim).- No client check of attachment count except uploader limit 10.
12.5 Send flow (+ViewModel.swift:333-367)
- Guard canSend. Capture draft/attachments,
clientId = UUID().uuidString; setisSending = true; clear draft and attachments. - Append optimistic message (508-538):
Message.Data(id: clientId, senderId: currentUser.id or "", receiverId, content, read false, createdAt Date()), sender = current user (fallback otherUser),isMine true, attachments mapped from upload responses (createdAt now,canModify true); sorted by createdAt. - If socket connected: store
pendingSends[clientId],socket.send(content, attachmentUids, clientId)and return true (the server echo replaces the optimistic bubble). The view bumpsattachmentsResetTokenon true (ConversationView.swift:213-219), which recreates the uploader. - Else REST fallback:
POST messages/sendJSON{receiver_uid, content, attachment_uids}(SDK:DevPlaceSwiftSDK.swift:500-513), sleep 500 ms,GET messages?with_uid=<uid>, remove optimistic, re-seed, refresh unread counts, return true. On error: remove optimistic, restore draft and attachments, show alert, return false.
12.6 Typing sender
userIsTyping() (369-377): only if socket connected; throttled to one frame per 1.5 s (lastTypingSentAt); fired on every draft change.
12.7 Unsent attachments
deleteUnsubmittedAttachments() (379-389): on screen disappear, for each attachment still in the composer call DELETE uploads/delete/<uid>; errors only logged.
12.8 Load / reload
load() (308-317) and reload() (319-331, guarded by isReloading): GET messages?with_uid=<otherUser.id> -> inbox; seedMessages (499-506): messages = server messages plus any still-pending optimistic ones not present, sorted ascending by createdAt; then loadUnreadCounts. The server marks messages read on this fetch (unread counts fall). Error -> alert.
12.9 Live websocket
Ticket and URL: POST messages/ws-ticket (JSON {ticket}), then URL wss://devplace.net/messages/ws?ticket=<percent-encoded ticket> (SDK:DevPlaceSwiftSDK.swift:521-540, ProdDevPlaceApi.swift:226-239; token refreshed first). A new ticket is fetched on every (re)connect (urlProvider called each loop, LiveMessagesSocket.swift:62).
LiveMessagesSocket (Request/Socket/LiveMessagesSocket.swift):
connect()(23-29) idempotent; starts connection loop.disconnect()(31-37): isActive false, cancel loop, cancel task with close code goingAway.- Loop (58-89): backoff starts 200 ms. Each iteration: get URL, create
URLSessionWebSocketTask, resume, reset backoff to 200 ms immediately after resume (66),receiveLoopuntil it throws. On exit (if still active): emit.disconnected; readcloseCode; if closeCode == 4013 delay 200 ms (server "replaced/limit" code, fast reconnect, backoff unchanged) else delay = current backoff thenbackoff = min(backoff*2, 5000); sleep, repeat. Note: because backoff resets to 200 on each successfulresumebefore receive, effective delay is generally 200 ms unless URL fetch itself throws (then it doubles 200, 400, 800, 1600, 3200, 5000 capped). - Receive (91-105): text frames decoded as UTF-8 JSON, binary frames decoded directly; unrecognised -> log only.
- Send (39-56, 115-122): sends text frame on current task; if no task, silently dropped; errors logged.
- Frames, server -> client (
SDK:Messaging/ChatSocketFrameCoding.swift:7-66, types inChatSocketFrameType.swift):{"type":"ready","user_uid":...}{"type":"message","uid","sender_uid","receiver_uid","content","created_at","attachments":[{uid,filename,url,size,is_image,is_video,mime_type,created_at,can_modify}]?,"client_id":?}{"type":"typing","from_uid":...}{"type":"read","by_uid":...}{"type":"error","client_id":?,"text":...}Attachment defaults: is_image/is_video false, mime "" , created now, can_modify false.
- Frames, client -> server (
ChatSocketFrameCoding.swift:71-95, 166-182):{"type":"send","receiver_uid","content","attachment_uids":[...],"client_id"},{"type":"typing","receiver_uid"},{"type":"read","with_uid"}.
ViewModel event handling (+ViewModel.swift:393-497):
startRealtime(393-403): no-op if socket exists; create socket forotherUser.id, start event loop task,await socket.connect().stopRealtime(405-416): connected=false, typing=false, cancel typing timer and event loop,socket.disconnect(), socket=nil..ready->isSocketConnected = true, sendreadframe{with_uid: otherUser.id}(marks incoming as read)..message(m)->upsertIncoming(440-460): ignore unless sender or receiver is the other user. Build Message (makeMessage545-562: isMine = senderUid == current user id; read false). IfclientIdmatches an optimistic message id -> replace it and clear pending; else replace same uid if present; else append. Sort ascending by createdAt. If not mine: sendreadframe and reload unread counts..typing(from)-> if from == other user:isOtherTyping = true, auto-clears after 4 s (reset timer on each frame, 462-470)..read(by)-> if by == other user: every own message getsread = true(472-479) which shows the double checkmark..failed(clientId, text)(481-491): remove optimistic bubble; if draft is empty restore content and attachments frompendingSends; show alert withtext(titleError,OK)..disconnected->isSocketConnected = false(sends then fall back to REST while reconnecting).
13. MessageBubbleView
U/Components/Message/MessageBubbleView.swift:5-141.
- Row: bubble
frame(maxWidth .infinity, alignment: isMine ? .trailing : .leading)(16). So mine right-aligned, other left-aligned. - Bubble content (19-44): custom
HuggingWidthLayout(maxWidth)(108-121: child sized with proposed width = maxBubbleWidth, so the bubble hugs content up to max) containingVStack(alignment: trailing if mine else leading, spacing 8)with padding horizontal 12 vertical 8 (35-36):- If content non-empty:
Markdown(content)with.markdownTheme(.devPlace),.markdownSoftBreakMode(.lineBreak)(single newlines render as line breaks),.selectableTextPopover(content)(long-press for raw text). - For each attachment:
AttachmentViewer(attachment)(section 17). - Footer
HStack(spacing 6):RelativeTimeLabel(createdAt)then, if mine,DoubleCheckmark(read).
- If content non-empty:
- Foreground FG_1 (38). Shape (56-63):
UnevenRoundedRectangleradii: topLeading 16, topTrailing 16; bottomLeading = mine ? 16 : 4; bottomTrailing = mine ? 4 : 16 (tail corner 4 at the sender side bottom). Clip + overlaystrokeBorder(FG_2 opacity 0.12, 1pt)(40-43). - Fill (69-105): vertical
LinearGradienttop to bottom frombubbleColor mixed with white by topBrightentobubbleColor mixed with black by bottomDarken.- bubbleColor: other = BG_1; mine = dark: accent mixed with black 0.55; light: accent mixed with white 0.6.
- topBrighten: mine dark 0.10, mine light 0.36, other dark 0.12, other light 0.
- bottomDarken: mine dark 0.10, mine light 0.08, other dark 0, other light 0.12.
mix(with:by:)= linear sRGB blend fraction toward the given color.
- DoubleCheckmark (123-140): drawn only when
readtrue (unread own messages show nothing, no single check). Two SFcheckmarkimages in ZStack offset x -3scale and +2scale, font system 10*scale semibold, color accentColor, accessibility labelRead.
14. TypingIndicatorView
U/Components/Message/TypingIndicatorView.swift:3-39. Three dots, HStack(spacing: dotSize*0.6) with dotSize = ScaledMetric 5 -> spacing 3. Each dot Circle FG_2, 5x5, opacity animates 0.3 <-> 1 with .easeInOut(duration 0.6).repeatForever().delay(index * 0.2) triggered by onAppear (isAnimating = true; autoreverses implied by repeatForever default true). Capsule container: padding h 10 v 8, background BG_1, clip RoundedRectangle radius 10, stroke FG_2 at 0.12 width 1. Accessibility label "<username> is typing".
15. Notifications screen
Files: U/Screens/Notifications/NotificationsView.swift, NotificationsView+ViewModel.swift. Entry from MainView (U/Screens/Main/MainView.swift:93) with reselectSignal, onOpenPost, onOpenConversation, onOpenOwnProfile.
15.1 Chrome
- Title
Notifications(41); BG_2 (40); alert (42). - Toolbar
.primaryAction(43-53), only when logged in: text buttonMark all read->viewModel.markAllRead(). - Pull to refresh ->
refresh()(54-56). - Tab reselect (57-63): when
reselectSignalflips and list is at top (contentOffset.y <= contentInsets.top, 105-109) ->refresh(). - Scene becomes active (64-69) ->
refresh(). Login state change (70-74) ->load()..task->load()(75-77). No websocket.
15.2 Layout
ScrollView (81): empty branch like Messages (emptyState padding top 80). Else LazyVStack(alignment .leading, spacing 20) .padding() (87-103):
- For each group (
groupSection, 130-166):VStack(alignment .leading, spacing 8): group labelText(group.label)headline (17 semibold) FG_2 (the label text comes from the server, e.g. a time bucket); thenBoxView(BG_1, paddingSize .none)withVStack(spacing 0)clipped radius 12, rows withDivider()between (158-160, compares ids). - Footer (91-100): if
nextCursor != nilaProgressViewpadding 16,maxWidth .infinity,onAppear { loadMore() }(infinite scroll).
15.3 NotificationRow (169-203)
Button(action: onSelect) plain style; label HStack(alignment .top, spacing 10), padding 12, background accentColor.opacity(0.08) if unread else clear, contentShape Rectangle:
- If
actorpresent:UserImage(user)normal 42 (176-178). Without actor no avatar (text shifts left). VStack(alignment .leading, spacing 4):Text(message)subheadline (15), FG_1, leading aligned, maxWidth infinity;RelativeTimeLabel(createdAt)(narrow).- If unread: 8x8 accent Circle
padding(.top 6).
15.4 States
- Not logged in:
Sign in required, symbolbell.slash,Sign in from the Settings tab to see your notifications. - Loading (
notifications == nil): centeredProgressView. - Empty:
No notifications,bell.slash,You're all caught up.(apostrophe is ASCII U+0027). - Errors: alert.
15.5 Data and actions (+ViewModel.swift)
load()(231-241): if not logged in,notifications = nil; elseGET notifications(no cursor), store.refresh()(243-254): same plusloadUnreadCounts(updates tab badges and app icon badge).loadMore()(260-274): guarded byisLoadingMoreand cursor;GET notifications?before=<ISO8601 cursor>(SDK:DevPlaceSwiftSDK.swift:543-549, cursor formattedDate.formatted(.iso8601)). Merge (379-392): groups with the samelabelget entries appended, new labels appended; then dedupe by entry id across all groups (394-415; duplicates logged "backend pagination bug"); empty groups dropped;nextCursorfrom the older page.open(notification)(276-287) on row tap:GET notifications/open/<uid>returns{ok, redirect}(the server marks it read); computes route, thenload()andrefreshUnreadCount(), returns the route. Error -> alert, no navigation.- Routing (289-306), in priority order:
type == .messageand actor present -> open Conversation with the actor.type == .badge-> own profile tab.type == .issue-> open Safari/web URLhttps://devplace.net/issues/<relatedId>.- Else parse
redirectURL: path segments, findposts, the next segment = post slug (316-324); comment target (326-354): fragment starting withcomment-,comment_,comment:orcomment(prefix stripped, non-empty) else query item namedcomment,comment_id,commentId,comment_uid(non-empty) else path segment aftercomments. ProducesPostDestination(slug, scrollToCommentId: "comment:" + uid or nil). No slug -> no navigation. Other types (comment, reply, mention, vote) go through step 4.
markRead(uid)(356-365, optimistic local read,POST notifications/mark-read/<uid>, on error alert + reload) exists but no view calls it;markAllRead()(367-377): optimistic mark all loaded entries read,POST notifications/mark-all-read, then refresh unread count; on error alert +load().- NotificationType raw values: comment, reply, mention, vote, message, issue, badge (
SDK:Models/TypedStrings/NotificationType.swift). - Model:
notification_groups[{label, entries[{notification{uid,type,message,read,related_uid,target_url,created_at}, actor?}]}],next_cursor(SDK:Models/Response/Notifications.swift).
16. Profile screen
Files: U/Screens/Profile/ProfileView.swift, ProfileView+ViewModel.swift. Entered with username (post header, PostHeaderView.swift:16) or nil for own profile (Settings tab, SettingsView.swift:36).
16.1 Chrome
- Title =
username ?? profile.user.username ?? "Profile"(+ViewModel.swift:28-30), default large title behavior..screenStyle()(BG_2). - Alerts: error alert (28); Block confirmation (29-41): title
Block <username>?, messageYou will no longer see their posts, comments or messages anywhere except on this profile., buttonsBlock(destructive) andCancel(cancel). Mute confirmation (42-54): titleMute <username>?, messageThey will no longer create notifications for you., buttonsMute(destructive),Cancel. .task->load()(55-57). No pull to refresh.
16.2 Layout tree
ScrollView > VStack(spacing 10) frame(maxWidth .infinity) padding() 16 (61-93). Rendered only if profile != nil (blank screen while loading; isLoading is not shown anywhere). In order:
UserImage(size .large 100)padding bottom 10.- numericInfoArea:
HStack(spacing 20)of stat columns:Posts(postsCount.formatted()),Level(user.level.formatted()),Stars(user.stars.formatted()), andRank("#<rank.formatted()>") only if rank non-nil (140-152). Each (228-239):VStack(spacing 2)multiline centered: value text system 18scale bold; labellabel.uppercased()system 14scale FG_2. - levelProgressArea, padding vertical 10 (154-170):
VStack(spacing 4):HStackwithText("Progress to next level"),Spacer, percent textDouble(xpProgressPercent)/100formatted.percent(e.g. 42%) , font system 12*scale, FG_2; thenProgressView(value:)linear bar (accent tint by default). - infoRowsArea (172-193):
VStack(spacing 10): section titleBio(semibold FG_2, leading);Markdown(user.bio)(default MarkdownUI theme, not.devPlace) leading aligned;Divider; rowLocationwith text right-aligned;Divider; rowGit Linkwith link;Divider; rowWebsitewith link. Info row (202-211):HStack { title (semibold FG_2); Spacer; Text(value) multiline trailing }. Link row (213-226): same but value isLink(destination: URL(string: link))showing the raw link text, trailing aligned, only if the string forms a URL (empty string yields URL?URL(string: "")is nil, so nothing is shown). - If not own profile (74-76):
blockMuteButtons()padding top 10 (97-138):HStack(spacing 12)of three.accentGradientbuttons eachframe(maxWidth 150)with label stretched to.infinity:Follow/Unfollow;Block/Unblock;Mute/Unmute. Tap behavior: Follow toggles directly (follow or unfollow call); Block shows confirmation when not blocked, calls unblock directly when blocked; Mute same with its confirmation. - Badges (81-86):
VFlowStack(spacing 8)(center aligned) ofUserBadgeViewfor each badge, padding top 10. - webAppInfo (241-247), padding top 10: centered
Textfrom markdownFor more info and options, visit this profile in the [web app](https://devplace.net/profile/<username>).(link styled with accent color, opens in browser).
16.3 Actions and API (+ViewModel.swift)
load()(40-53):GET profile/<username>(token optional) orGET profile(own profile, token required); setsprofile,isFollowing,isBlocked,isMutedfrom response flags.followPOST follow/<username>;unfollowPOST follow/unfollow/<username>;blockPOST block/<username>;unblockPOST block/unblock/<username>;mutePOST mute/<username>;unmutePOST mute/unmute/<username>(SDK:DevPlaceSwiftSDK.swift:370-399). Each flips the local flag only on success; failure -> alert, flag unchanged. No loading indicator on the buttons and no debounce.- Profile fields used: user(username, avatarSeed, bio, location, gitLink, website, level, stars), postsCount, rank?, xpProgressPercent (Int 0..100), badges[{name?, icon?}], isOwner, isFollowing, isBlocked, isMuted.
17. AttachmentViewer and media components
U/Components/Media/AttachmentViewer.swift:4-68.
- URL resolution (62-68): if
attachment.urlstarts with/prefixhttps://devplace.net; else used as is. Invalid URL -> nothing rendered. - Video (36-43):
Buttonplain ->VideoThumbnailView(url); tap opens full-screen cover video player; accessibilityVideo attachment. Tap to play. - Image (44-59):
Buttonplain ->CachedAsyncImage(url) { image.resizable().scaledToFit() } placeholder: { ProgressView().frame(maxWidth .infinity) }; tap opens full-screen image; accessibilityImage attachment. Tap to view fullscreen. - Neither image nor video (audio, files): nothing is rendered at all (no file chip).
- Full-screen via
.fullScreenCover(item:)(24-31).
17.1 CachedAsyncImage
U/Components/Media/CachedAsyncImage.swift:4-63. Thin wrapper over the NetworkImage library (NetworkImage(url:scale:transaction:)), mapping state empty -> .empty, success -> .success(image), failure -> .failure(...). Convenience init (30-48): content closure when phase.image present else placeholder (failure also shows placeholder = spinner forever). Caching: handled by the NetworkImage library (memory plus URLCache/disk; policy not defined in this repo, UNVERIFIED). Default scale 1.
17.2 VideoThumbnailView
U/Components/Media/VideoThumbnailView.swift:4-45. ZStack: thumbnail Image resizable scaledToFit, or placeholder Color.BG_2 with aspect ratio 16:9 fit and ProgressView overlay; on top an SF play.circle.fill size 60, foreground white with black.opacity(0.5) secondary, shadow radius 4, hidden from accessibility. Thumbnail via AVAssetImageGenerator at time zero, appliesPreferredTrackTransform, maximumSize 800 x 0 (aspect preserved); on error logged and placeholder stays.
17.3 FullscreenImageViewer
U/Components/Media/FullscreenImageViewer.swift:3-50. NavigationStack, inline title, leading Done button (dismiss), trailing ShareLink of the image (preview title Image) only after loaded; content: ProgressView tinted white until the image data downloads (URLSession.shared.data, task keyed to url), then ZoomableImage.
17.4 ZoomableImage
U/Components/Media/ZoomableImage.swift:3-48. Image resizable scaledToFit; MagnifyGesture scale clamped to [1, 5] (min(max(1, lastScale*magnification), 5)); on end, if scale <= 1 offset resets with easeOut(0.2). DragGesture (simultaneous) pans only when scale > 1 (offset = lastOffset + translation). No double-tap zoom, no pan clamping.
17.5 FullscreenVideoPlayer
U/Components/Media/FullscreenVideoPlayer.swift:4-37. NavigationStack with AVKit VideoPlayer(AVPlayer(url)) ignoring bottom safe area, leading Done, trailing ShareLink(item: url); onAppear play (autoplay), onDisappear pause.
18. AttachmentUploaderView
Files U/Components/AttachmentUploader/AttachmentUploaderView.swift, +ViewModel.swift. Params: isSmall (false), initial attachments, onAttachmentsChange callback (called on every change of the list via didSet, +ViewModel.swift:12-16).
18.1 Layout (81-165)
isSmalland no attachments (82-84, 104-110): bare small button:ProgressViewwhile busy else the add button; label (157-161) icon-onlypaperclip(Add Attachment), color FG_2, font system 14*scale.- Otherwise (85-100):
BoxView(BG_2 default, padding 12, radius 12, border FG_2 at 0.25) containingVStack(alignment .leading, spacing 10): one row per attachment; a centeredProgressViewwhile busy; ifcanAddMore(count < 10) the add button. - Row (112-133):
HStack(spacing 10): icon (FG_2)photoif image,filmif video, elsedoc;Text(filename ?? "file")lineLimit 1, truncation middle, fill width, leading; trash button (plain style, red,Image("trash"), disabled while busy) ->delete. - Full variant add button label:
Label("Add Attachment", systemImage: "paperclip")with text visible. - Add button (135-154): tapping opens a confirmation dialog titled
Add Attachment(title visible) with buttonsPhoto Library,Files,From URL,Cancel(cancel). Button disabled while busy.
18.2 Sources and API
Photo Library(49-60, 167-178): PhotosPicker matching images or videos; on selection loadsDatathen uploads with filenameattachment.<preferred extension>(orattachment) and the content type's preferred MIME (fallbackapplication/octet-stream); selection cleared afterward. Missing data ->CancellationError(silent).Files(41-48,+ViewModel.swift:36-59): file importer (any item); reads the whole file into memory with security-scoped access; filename = last path component; MIME from file content type orapplication/octet-stream; upload.From URL(61-78): alert titledAdd from URL, messageEnter the URL of the file to attach., text field placeholderhttps://…(no autocapitalization, no autocorrect, URL content type), buttonsCancel(cancel; clears text) andAdd(clears text and uploads).uploadFromUrltrims whitespace/newlines; empty -> ignored (+ViewModel.swift:61-69).upload(95-106): guarded by!isBusy; sets busy; on success append theUploadResponse; on failure alert.- API:
POST uploads/uploadmultipartfilefield (boundaryBoundary-<UUID>) ->{uid, original_filename, url, size, is_image, is_video, is_audio, mime_type, ...};POST uploads/upload-urlJSON{url, filename};DELETE uploads/delete/<uid>(SDK:DevPlaceSwiftSDK.swift:587-618). Delete (82-93): guarded!isBusy, remove from list only on success, else alert. - All three entry points no-op silently when
!canAddMore(max 10). No per-file size limit is enforced client-side. Errors use the standard alert. - No upload progress (indeterminate spinner only).
19. MentionSuggestionsView (used by CommentEditorView, not by chat)
Files U/Components/Mention/MentionSuggestionsView.swift, +ViewModel.swift, MentionToken.swift. Instantiated at U/Components/Comment/CommentEditorView.swift:25.
19.1 Token detection (MentionToken.swift:9-40)
Given text and caret (nil = end), scan backward from the caret over mention characters (letter, number, _, via Character.isLetter/isNumber); when @ is found it counts only if it is at text start or preceded by whitespace; query = text between @ and caret; the replaced range extends forward from the caret over further mention characters (previous..<end). Any other character before finding @ -> no active token.
19.2 ViewModel (+ViewModel.swift)
update(text, caret, participants)(22-41): no token -> deactivate (cancel search, clear suggestions). Token with empty query -> suggestions = participants (exclude current user, 77-79) with no network call. Token with new query -> debounce 300 ms (16, 58) thenGET messages/search?q=<query>(api.usersForMentioning), results filtered to exclude current user; stale results dropped via task cancellation; errors only logged.dismiss()close button deactivates until text/caret changes again (next update re-activates).
19.3 View
- Shown only when
isActive && !suggestions.isEmpty: opacity 1/0, hit-testing toggled, bottom padding 8 when shown (47-49). Height animation.smooth(duration 0.25)keyed on list height (50). A GeometryReader background publishesMentionListHeightKey(max of children) so the parent can reserve space (51-55). - List (71-95):
BoxView(borderOpacity 0.5, cornerSize .big (14), paddingSize .none)(background default BG_2) containingScrollViewwith VStack spacing 0 of rows; height =min(max(contentHeight, 50), 164)(ScaledMetric 50 and 164; 97-102); clip radius 14 continuous; shadow black 0.2, radius 12, y 4 (94). - Row (123-143): plain button,
HStack(spacing 10):UserImage(seed: avatarSeed ?? username, size .small 30),Text(username)medium weight lineLimit 1,Spacer; padding h 12 v 8; FG_1. Tap ->onSelect(result). - Close button (91-93, 108-121): top-trailing overlay,
xmarkicon (accessibilityClose suggestions), caption2 semibold FG_2, padding 7 insideCircleBG_1, outer padding 4.
20. EmojiPicker and EmojiCatalog
Files U/Components/EmojiPicker/EmojiPicker.swift, EmojiCatalog.swift. Presented from ReactionsBar (U/Components/Reaction/ReactionsBar.swift:35) as a navigation sheet. Params dismissOnPick = true, onPick.
20.1 Layout (EmojiPicker.swift)
- Constants (13-16): cell 44x44, cell spacing 4, horizontal padding 8, emoji font size 30.
- Columns (43-46):
max(1, Int((width - 16 + 4) / (44 + 4))), width from GeometryReader. - Background BG_2 (28).
.searchable(text, prompt: "Search Emoji")(29). Inline nav title (empty), leading toolbar buttonxmarkicon, accessibility labelClose, dismisses (31-40). - Browse mode (48-70, search empty):
VStack(spacing 0):ScrollView(maxHeight .infinity) withVStack(alignment .leading, spacing 12)padding h 8, bottom 8: optionalRecentsection (ifappSettings.recentEmojisnon-empty) then one section per catalog category with.id(category.id); then the category bar. - Section (89-95):
VStack(alignment .leading, spacing 4): header + rows. Header (129-136):title.uppercased()caption (12) semibold FG_2, leading, padding v 4. Rows (97-107): emojis chunked by column count; each rowHStack(spacing 4)of emoji buttons + trailingSpacer(minLength 0)(left aligned grid). Emoji button (138-151):Text(emoji)size 30 in 44x44 frame, plain style. - Category bar (109-127):
HStack(spacing 0)bottom bar, background BG_1; one plain button per category, iconImage(systemName: symbolName)size 16,frame(maxWidth .infinity), padding v 10, color FG_2; tap ->withAnimation { proxy.scrollTo(category.id, anchor: .top) }(default animation).Recenthas no bar button. - Search mode (72-87):
EmojiCatalog.emojis(matching:); empty result ->Text("No emoji found")FG_2 centered, padding top 40; else grid with spacing 4, padding h 8. - Pick (138-145):
onPick(emoji),AppSettingsStore.recordEmojiPick(emoji), dismiss ifdismissOnPick. - Recents (
Stores/AppSettingsStore.swift:14,19,45,75,81-84): persisted in UserDefaults keyrecentEmojis(array of strings); on pick the emoji is removed from the list if present, inserted at the front, truncated tomaxRecentEmojis = 30.
20.2 Catalog data structure (EmojiCatalog.swift)
struct EmojiCategory { name: String; symbolName: String (SF Symbol); emojis: [String]; id = name }(3-9).EmojiCatalog.categories: [EmojiCategory]static array (12-123); each emoji is one SwiftString(a full grapheme cluster, including variation selector U+FE0F and ZWJ sequences, e.g. the rainbow flag and pirate flag).- Search (125-138):
searchName(emoji)= names of each Unicode scalar (properties.name, the Unicode character name, e.g. "GRINNING FACE") joined by space, lowercased.emojis(matching:): query lowercased and trimmed of spaces/tabs; empty -> []; result = all emojis (flattened across categories, in catalog order, duplicates kept) whose searchName contains the query as a substring. So search is English Unicode-name substring match only (no keywords/aliases). Port needs a Unicode name table (UnicodeData.txt) for these scalars. - Utility
Array.chunked(into:)(141-148): splits into rows ofsize; size <= 0 returns[self]. - Counts (counted from source; some emojis appear in two categories: the star characters appear in both Animals & Nature and Symbols):
| # | Category name | SF Symbol | Count | Source lines |
|---|---|---|---|---|
| 1 | Smileys & Emotion | face.smiling | 142 | 13-27 |
| 2 | People & Body | hand.raised | 51 | 28-37 |
| 3 | Animals & Nature | leaf | 101 | 38-50 |
| 4 | Food & Drink | fork.knife | 80 | 51-61 |
| 5 | Activity | figure.run | 75 | 62-72 |
| 6 | Travel & Places | airplane | 98 | 73-85 |
| 7 | Objects | lightbulb | 133 | 86-100 |
| 8 | Symbols | number | 140 | 101-115 |
| 9 | Flags | flag | 7 | 116-122 |
Total 827 entries. The full data lists are reproduced verbatim in the Appendix at the end of this document (generated from the Swift source, same order).
21. Gesture and navigation summary
| Surface | Gesture / control | Result |
|---|---|---|
| Messages row | tap | push Conversation (NavigationLink value User) |
| Messages | pull down / reload button | reload() |
| Conversation | tap on message area | dismiss keyboard |
| Conversation | drag scroll | keyboard dismisses interactively |
| Conversation | chevron button | animated scroll to bottom |
| Message bubble text | long press (0.5 s) | popover with raw selectable text, select first word, select all, copy, insert as quote |
| Attachment image | tap | fullscreen zoom viewer (pinch 1x..5x, pan when zoomed, Done, Share) |
| Attachment video | tap | fullscreen autoplay player (Done, Share) |
| Notification row | tap | open notification then route (conversation / own profile / web issue / post with comment scroll) |
| Notifications | pull, tab reselect at top, app foreground | refresh() |
| Notifications | scroll to bottom spinner | loadMore() |
| Profile | Follow / Unfollow, Block, Mute buttons | see 16.2 |
| Emoji grid | tap | pick, record recent, dismiss |
| Emoji bar icon | tap | animated scroll to category |
| Text editor corner (bottom 24 pt) | drag | resize height |
22. Gaps and notes for the C++ port
- Relative-time and Dynamic Type values are not measured (see sections 3, intro).
- CoreSVG is a private Apple framework; a C++ build needs its own SVG rasterizer.
NetworkImagecache behavior is library-defined and not in this repo.- Messages list never updates live (no socket on that screen); only the Conversation screen has a socket.
markRead(uid)in Notifications view model and theisLoadingflag in Profile are defined but have no UI effect.- MarkdownUI default theme sizes used for message and bio text are not in this repo.
Appendix A. EmojiCatalog data (verbatim order)
Smileys & Emotion (face.smiling, 142)
😀 😃 😄 😁 😆 😅 😂 🤣 🥲 ☺️ 😊 😇 🙂 🙃 😉 😌 😍 🥰 😘 😗 😙 😚 😋 😛 😝 😜 🤪 🤨 🧐 🤓 😎 🥸 🤩 🥳 😏 😒 😞 😔 😟 😕 🙁 ☹️ 😣 😖 😫 😩 🥺 😢 😭 😤 😠 😡 🤬 🤯 😳 🥵 🥶 😱 😨 😰 😥 😓 🤗 🤔 🤭 🤫 🤥 😶 😐 😑 😬 🙄 😯 😦 😧 😮 😲 🥱 😴 🤤 😪 😵 🤐 🥴 🤢 🤮 🤧 😷 🤒 🤕 🤑 🤠 😈 👿 👹 👺 🤡 💩 👻 💀 ☠️ 👽 👾 🤖 🎃 😺 😸 😹 😻 😼 😽 🙀 😿 😾 ❤️ 🧡 💛 💚 💙 💜 🖤 🤍 🤎 💔 ❣️ 💕 💞 💓 💗 💖 💘 💝 💯 💢 💥 💫 💦 💨 🕳️ 💬 💭 💤
People & Body (hand.raised, 51)
👋 🤚 🖐️ ✋ 🖖 👌 🤌 🤏 ✌️ 🤞 🤟 🤘 🤙 👈 👉 👆 🖕 👇 ☝️ 👍 👎 ✊ 👊 🤛 🤜 👏 🙌 👐 🤲 🤝 🙏 ✍️ 💅 🤳 💪 🦾 🦵 🦿 🦶 👂 🦻 👃 🧠 🫀 🫁 🦷 🦴 👀 👁️ 👅 👄
Animals & Nature (leaf, 101)
🐶 🐱 🐭 🐹 🐰 🦊 🐻 🐼 🐨 🐯 🦁 🐮 🐷 🐸 🐵 🙈 🙉 🙊 🐔 🐧 🐦 🐤 🦆 🦅 🦉 🐴 🦄 🐝 🐛 🦋 🐌 🐞 🐜 🕷️ 🐢 🐍 🦖 🐙 🦑 🦀 🐠 🐟 🐬 🐳 🐋 🦈 🐊 🐅 🐆 🦓 🦍 🐘 🐫 🦒 🐄 🐎 🐖 🐏 🐑 🐐 🦌 🐕 🐩 🐈 🌵 🎄 🌲 🌳 🌴 🌱 🌿 ☘️ 🍀 🎍 🌾 🌷 🌹 🥀 🌺 🌸 🌼 🌻 🌞 🌝 🌚 🌙 ⭐ 🌟 ✨ ⚡ ☄️ 🔥 🌈 ☀️ ⛅ ☁️ 🌧️ ⛈️ ❄️ ⛄ 🌊
Food & Drink (fork.knife, 80)
🍏 🍎 🍐 🍊 🍋 🍌 🍉 🍇 🍓 🫐 🍈 🍒 🍑 🥭 🍍 🥥 🥝 🍅 🍆 🥑 🥦 🥬 🥒 🌶️ 🌽 🥕 🧄 🧅 🥔 🍠 🥐 🥯 🍞 🥖 🧀 🥚 🍳 🥞 🧇 🥓 🍔 🍟 🍕 🌭 🥪 🌮 🌯 🥙 🍜 🍝 🍣 🍱 🍛 🍚 🍙 🍥 🥟 🍤 🍦 🍰 🎂 🧁 🥧 🍫 🍬 🍭 🍩 🍪 ☕ 🍵 🧃 🥤 🍺 🍻 🥂 🍷 🥃 🍸 🍹 🧉
Activity (figure.run, 75)
⚽ 🏀 🏈 ⚾ 🥎 🎾 🏐 🏉 🥏 🎱 🪀 🏓 🏸 🥅 🏒 🏑 🥍 🏏 ⛳ 🏹 🎣 🥊 🥋 🎽 ⛸️ 🥌 🛷 🎿 ⛷️ 🏂 🏋️ 🤼 🤸 ⛹️ 🤺 🤾 🏌️ 🏇 🧘 🏄 🏊 🤽 🚣 🧗 🚵 🚴 🏆 🥇 🥈 🥉 🏅 🎖️ 🎗️ 🎫 🎪 🤹 🎭 🎨 🎬 🎤 🎧 🎼 🎹 🥁 🎷 🎺 🎸 🎻 🎲 ♟️ 🎯 🎳 🎮 🎰 🧩
Travel & Places (airplane, 98)
🚗 🚕 🚙 🚌 🚎 🏎️ 🚓 🚑 🚒 🚐 🚚 🚛 🚜 🛴 🚲 🛵 🏍️ 🚨 🚔 🚍 🚘 🚖 🚡 🚠 🚟 🚃 🚋 🚞 🚝 🚄 🚅 🚈 🚂 🚆 🚇 🚊 🚉 ✈️ 🛫 🛬 🛩️ 💺 🚀 🛸 🚁 🛶 ⛵ 🚤 🛥️ 🚢 ⚓ ⛽ 🚧 🚦 🚥 🗺️ 🗿 🗽 🗼 🏰 🏯 🏟️ 🎡 🎢 🎠 ⛲ ⛱️ 🏖️ 🏝️ 🏜️ 🌋 ⛰️ 🏔️ 🗻 🏕️ ⛺ 🏠 🏡 🏢 🏬 🏭 🏥 🏦 🏨 🏪 🏫 ⛪ 🕌 🕍 🛕 🌃 🌆 🌇 🌉 🌌 🎆 🎇 🌠
Objects (lightbulb, 133)
⌚ 📱 💻 ⌨️ 🖥️ 🖨️ 🖱️ 💽 💾 💿 📀 📷 📸 📹 🎥 📞 ☎️ 📟 📠 📺 📻 🧭 ⏰ ⏱️ ⏲️ 🕰️ ⌛ ⏳ 📡 🔋 🔌 💡 🔦 🕯️ 🧯 🛢️ 💸 💵 💴 💶 💷 💰 💳 🧾 💎 ⚖️ 🧰 🔧 🔨 ⚒️ 🛠️ ⛏️ 🔩 ⚙️ 🧱 ⛓️ 🧲 🔫 💣 🧨 🪓 🔪 🗡️ ⚔️ 🛡️ 🚬 ⚰️ ⚱️ 🏺 🔮 📿 🧿 💈 ⚗️ 🔭 🔬 💊 💉 🩹 🩺 🌡️ 🧬 🦠 🧫 🧪 🧹 🧺 🧻 🚽 🚿 🛁 🧼 🧽 🛎️ 🔑 🗝️ 🚪 🛋️ 🛏️ 🧸 🖼️ 🛍️ 🛒 🎁 🎈 🎏 🎀 🎊 🎉 🏮 ✉️ 📩 📨 📧 💌 📦 🏷️ 📚 📖 🔖 📎 📐 📏 🧮 📌 📍 ✂️ 🖊️ ✏️ 🔍 🔎 🔒 🔓
Symbols (number, 140)
☮️ ✝️ ☪️ 🕉️ ☸️ ✡️ 🔯 🕎 ☯️ ☦️ 🛐 ⛎ ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓ 🆔 ⚛️ ☢️ ☣️ ❌ ⭕ 🛑 ⛔ 📛 🚫 ❗ ❕ ❓ ❔ ‼️ ⁉️ ⚠️ 🚸 🔱 ⚜️ 🔰 ♻️ ✅ ❇️ ✳️ ❎ 🌐 💠 Ⓜ️ 🌀 🏧 🚾 ♿ 🅿️ 🚹 🚺 🚼 🚻 🚮 🎦 🔣 ℹ️ 🔤 🔡 🔠 🆖 🆗 🆙 🆒 🆕 🆓 ▶️ ⏸️ ⏯️ ⏹️ ⏺️ ⏭️ ⏮️ ⏩ ⏪ 🔀 🔁 🔂 ◀️ 🔼 🔽 ⏫ ⏬ ➡️ ⬅️ ⬆️ ⬇️ ↗️ ↘️ ↙️ ↖️ ↕️ ↔️ ↩️ ↪️ 🔄 🔃 ➕ ➖ ➗ ✖️ ♾️ 💲 ™️ ©️ ®️ 🔚 🔙 🔛 🔝 🔜 ✔️ ☑️ 🔘 ⚪ ⚫ 🔴 🔵 🟤 🟣 🟢 🟡 🟠 🔺 🔻 🔸 🔹 🔶 🔷 ⭐ 🌟
Flags (flag, 7)
🏁 🚩 🎌 🏴 🏳️ 🏳️🌈 🏴☠️