Skip to content

Next Generation - #6

Merged
henrik-dmg merged 108 commits into
masterfrom
internal/next-generation
Mar 3, 2020
Merged

henrik-dmg merged 108 commits into
masterfrom
internal/next-generation

Conversation

@henrik-dmg

Copy link
Copy Markdown
Member

This is an almost complete rewrite of the tool which also changes some of its functionality.
Swiftframe now supports:

  • Completely unrestricted placement of screenshots across a canvas, which is then cropped up according to device display size
  • Styling of text directly in the string itself using HTML tags (for example: <b>Some bold text</b>)
  • .string files, which are commonly used in iOS/macOS development. It enables the string lookup by key rather than index so that strings don't necessarily have to be in the same order across locales
  • Some more improvements which will be mentioned in release notes once this PR goes through

print("Parsed and validated config file\nRendering...\n")

var fileWriteFinishers = 0
let requiredFileWrites = data.deviceData.count * data.titles.count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right, the dispatch group cannot wait on the main thread. However, I think what you could do is "block" the main thread with the run loop semaphore like you do now, then dispatch to a background queue, create the dispatch group there and then dispatch the individual tasks from there.

I think what you have now should work in most cases. However, I believe things like fileWriteFinishers += 1 are not atomic operations (it's executed as let tmp = fileWriteFinishers + 1; fileWriteFinishers = tmp) which means with multiple threads there's the potential for race conditions that lead to incorrect values. Dispatch groups and semaphore are generally made exactly to avoid such manual counting and the potential problems associated with it.

Comment thread README.md Resolved
print("Parsed and validated config file\nRendering...\n")

var fileWriteFinishers = 0
let requiredFileWrites = data.deviceData.count * data.titles.count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you try moving the dispatch group to a background thread?

@henrik-dmg henrik-dmg linked an issue Mar 2, 2020 that may be closed by this pull request
Comment thread README.md Resolved
@@ -0,0 +1,16 @@
import Foundation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Femto-nit: I think these and others aren't really "mocks". They don't mock behavior. Instead it's just static data. Maybe "...Fixtures" would be a more correct file name though this is really nitpicky.

@henrik-dmg
henrik-dmg merged commit 0f837a0 into master Mar 3, 2020
@henrik-dmg
henrik-dmg deleted the internal/next-generation branch March 4, 2020 09:06
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

Successfully merging this pull request may close these issues.

Add support for highlighting words within the title Use YAML instead of JSON for config file

3 participants