{"id":2871,"date":"2014-07-04T22:13:24","date_gmt":"2014-07-05T01:13:24","guid":{"rendered":"http:\/\/brockerhoff.net\/blog\/?p=2871"},"modified":"2014-07-07T22:52:12","modified_gmt":"2014-07-08T01:52:12","slug":"swiftchecker-a-simple-swift-app","status":"publish","type":"post","link":"https:\/\/brockerhoff.net\/blog\/2014\/07\/04\/swiftchecker-a-simple-swift-app\/","title":{"rendered":"SwiftChecker: a simple Swift app"},"content":{"rendered":"<p>Well, finally I&#8217;ve decided to try out this newfangled GitHub stuff. Here&#8217;s my first repository: <a href=\"https:\/\/github.com\/rbrockerhoff\/SwiftChecker\" target=\"_blank\">SwiftChecker, a simple\u00a0<\/a><span style=\"color: #666666;\"><a href=\"https:\/\/github.com\/rbrockerhoff\/SwiftChecker\" target=\"_blank\">real-world OS X app<\/a> written in Swift. Quoting the readme file:<\/span><\/p>\n<blockquote><p>\u00a0My main intentions were to learn something about having parts in Swift and parts in ObjC; also to translate some of my experience with asynchronous execution to Swift. Since GCD and blocks\/closures are already a part of system services and the C language (contrary to some people who claim they&#8217;re ObjC\/Cocoa APIs), I found that it&#8217;s easy to call them from Swift either directly or with some small convenience wrappers.<\/p>\n<p>The application displays a single window containing a table of running applications\/processes (user space only).<\/p>\n<p>For each process, it displays the icon, name and containing folder, as well as sandbox status (if present) and summaries for signing certificates (if present).<\/p>\n<p>The table is not updated automatically, but there&#8217;s a refresh button to update it. A suggested exercise would be to listen to notifications for application start\/stop and update the list dynamically.<\/p>\n<p>Updating the table might potentially take some time if the system is very busy, since code signatures and icons will probably have to be loaded from disk. To speed this up, a simple &#8220;Future&#8221; class is implemented and used to perform these accesses asynchronously. In my timing tests, this accelerates table refresh by just under 4x \u2014 quite fair on a 4-core machine.<\/p>\n<p>The project should build and run with no errors, warnings or crashes on OS X 10.10b3 and Xcode 6.0b3.<\/p>\n<p>There are copious comments that, hopefully, explain some of the design decisions and workarounds where necessary.<\/p><\/blockquote>\n<p>I&#8217;ve also updated my previous post (<a href=\"\/blog\/2014\/06\/26\/swift-a-simple-future\/\" target=\"_blank\">Swift: a Simple Future<\/a>)\u00a0to incorporate some changes and simplifications I made during development of SwiftChecker. Check out the <a href=\"https:\/\/github.com\/rbrockerhoff\/SwiftChecker\/blob\/master\/SwiftChecker\/Future.swift\" target=\"_blank\">Future.swift<\/a> file from the repository for a compilable file, with many comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, finally I&#8217;ve decided to try out this newfangled GitHub stuff. Here&#8217;s my first repository: SwiftChecker, a simple\u00a0real-world OS X app written in Swift. Quoting the readme file: \u00a0My main intentions were to learn something about having parts in Swift and parts in ObjC; also to translate some of my experience with asynchronous execution to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,4,19],"tags":[47],"class_list":["post-2871","post","type-post","status-publish","format-standard","hentry","category-apple","category-dev","category-software","tag-swift"],"featured_image_src":null,"author_info":{"display_name":"Rainer Brockerhoff","author_link":"https:\/\/brockerhoff.net\/blog\/author\/rbrockerhoff\/"},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1q3Zc-Kj","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/posts\/2871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/comments?post=2871"}],"version-history":[{"count":0,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/posts\/2871\/revisions"}],"wp:attachment":[{"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/media?parent=2871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/categories?post=2871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/tags?post=2871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}