jessesquires / jessesquires.com Goto Github PK
View Code? Open in Web Editor NEWTuring complete with a stack of 0xdeadbeef
Home Page: https://www.jessesquires.com
License: Other
Turing complete with a stack of 0xdeadbeef
Home Page: https://www.jessesquires.com
License: Other
Really dig the aesthetics of http://swiftweekly.github.io which was adapted from this site.
Bring back some of these stylistic changes:
That should never happen. A UIViewController should never have a dependency that isn't A. A UIKit object or B. Its Delegate or Datasource. There are no other dependencies to inject into a VC.
In this article http://www.jessesquires.com/better-coredata-models-in-swift/, you say non-optional values should be written as such (without question mark) in the generated Swift files.
I must disagree.
The model says it is invalid for a given property to have a nil value saved in the persistent store. However, it is perfectly valid for an unsaved entity to have a nil value! (If it has just been created for instance.) Even though it should most of the time not happen.
These properties should be of type "optional but generally not nil," aka. the type followed by an exclamation point.
Your example would then become:
class Employee: NSManagedObject {
@NSManaged var address: String?
@NSManaged var dateOfBirth: NSDate!
@NSManaged var email: String?
@NSManaged var firstName: String!
@NSManaged var lastName: String!
@NSManaged var middleName: String?
@NSManaged var salary: NSDecimalNumber
@NSManaged var status: Int32
}
Hi
You say that is better not to use it because may be more dirty... but there are places where it make sence like make an init of an object with a JSON, so if the json don't have the requirements attributes... it will return a nil object.
You can extend the object class with the init?(json: JSON)
constructor in your own class that make the request and just call that constructor with an if let myObject = MyObject(json) {}
.
What do you think?
Thanks for your blog that helped me find this - but here is an alternative approach to this problem on Stack Exchange that avoids making lots if things public:
http://stackoverflow.com/a/26795795/2466193
(Credit, of course, to the SO poster, not me who just found it!)
It’s even worse in Objective-C — there are no errors or warnings for incomplete switch statements --> there are actually although they used to be hidden in -Weverything and maybe still are :). -Weverything, clang diagnostic, and warning flags are your friend :).
I'm using JSQMessageVC, But this cause a bug in my app. when i push JSQMessageVC, the content size of a scrollview in the parentVC change ...
Before :
myScrollview.contentSize = 1000, 375
And after
myScrollview.contentSize = 2.5, 750.0
Do you know why?
JSQMessageVC cause a bug in all scrollview size in my app....
Thanks!
¯\_(ツ)_/¯
web dev
Very low pri.
HTTPS on gh-pages:
https://vickylai.io/verbose/free-custom-domain-website-https/
Using jekyll on NFS:
https://underhilllabs.github.io/Web%20Development/2012/05/11/jekyll-on-nfsn/
http://www.jessesquires.com/adaptive-user-interfaces/
I linked to it for my art director.
You wrote "Finally, I should note that iOS 8 also provides an unspecified size class, which essentially means any size class. In other words, an unspecified size class means that a view should always display and behave the same way, regardless of other UI elements or the current device."
I offered him what I hope is a great example of this that you might want to add to your article. A Phone Number Pad. This is a UI element most people want to be about the same size no matter the display (iPhone 4 -> iPad largest) as it is a simulator for a physical thing for a human hand.
Hi Jesse, the first blog was interesting but part II caught my attention because the advantage for Swift was just too stratospheric to be true. :) So I quickly noticed that the Obj-C is using NSMutableArray to hold the data being sorted; this is massively inefficient as this array is a container class that imposes extra allocation, message calls and other overheads, but more important, stores all data as objects, so the integer values are boxed. I'm not familiar with Obj-C development at all so I'm not sure of the fine details (e.g. which optimizations the Obj-C compiler may be able to perform to reducing those costs) but it's a huge smoking gun considering many similar systems.
The fair benchmark would use C-style arrays in Obj-C code; it seems to me that Swift's arrays are lightweight, type-specific by-value arrays (largely equivalent to C's even if having some extra features like dynamic sizing). They are also language-level features so the compiler is more likely to have all sorts of special tricks to make that fast. I guess you may have used the NSMutableArray because that may be the more common idiom in Obj-C apps, but for tasks like sorting thousands of integer values no sane programmer would put up with that overhead just for the sake of good OO practices, I hope. Anyway, with the code that you have today, the objective of comparing equivalent compiler optimizations or language features is not achieved (the NS* classes are not even part of the language, they are just libraries).
Jesse,
thanks for the post on Jazzy documentation. I just added that to my ExpandableDatePicker project. You should obviously use it because it's awesome :)
Anyways, you mentioned that github will automatically publish that documentation now, but if I go to that repository I don't see where it's actually published.
Hi Jesse,
I read your blog post on swift documentation using GitHub pages. I really like it - great ideas and a great tutorial.
I have one question left regarding the documentation: Do you have any ideas/ recommendations how to handle different versions of the documentations for your repos?
Ben
https://jekyllrb.com/docs/configuration/markdown/
highlighter: rouge
Twilight for swift:
Pygments:
Rouge preview:
I wish I'd read your article before upgrading to Swift 3. You say "resist doing any other refactoring during the migration". Instead I took the opportunity to move lots of methods into a more logical order, which has made merging or rebasing with other work branches extremely painful :-(
I also was not expecting that all my button relationships in my storyboard would be broken by the code changes and require redoing.
Would rather have this URL scheme.
jessesquires.com/blog/my-cool-post
Investigate setting up redirects in jekyll for the old URLs.
Improvement request - Also show the final code for NavigationItemConfigurable extension so that it is clearer by just looking at the code - Add -
extension NavigationItemConfigurable where Self: UIViewController {
func configureNavigationItem() {
navigationItem.leftBarButtonItem = UIBarButtonItem(
barButtonSystemItem: .Cancel,
target: self,
action: #selector(didTapCancelButton(_:)))
}
}
TO be clear it is mentioned - "Our previous extension on ViewControllerType can move to NavigationItemConfigurable instead" - but folks tend to look at the code snippet first and it is not included there
Find a way to programmatically grab article snippets for front page instead of doing this manually in front matter.
Posts
Other pages
Manage jqery and bootstrap with bower?
Looks like bower is recommending yarn for new projects now.
Currently 70/100
on google page speed:
https://developers.google.com/speed/pagespeed/insights/?url=jessesquires.com
A submission for the weekly Open Source Swift newsletter:
http://moreindirection.blogspot.com/2015/12/working-on-swift-compiler-with.html
Hi Jesse,
I saw your article http://www.jessesquires.com/refactoring-singletons-in-swift/
Nice, I liked.
But singletons are nice because they're really easy to use. Creating dependency injection for each use of singletons will make them much more hard to use.
So, I suggest different idea. To create a new singleton. AppEnviroment.
He will keep references to all singletons used across the app.
I created a gist with raw implementation.
https://gist.github.com/AndreiVidrasco/7469e573934f7fe16cdbd1e72c8474c1
Can you check out and say what do you think?
Thanks,
Andrei
Thanks for an awesome article!
Do you use force unwrapping in the parser?
Say I have JSON like this:
{
"id": 1,
"name": "Lars"
}
Would you do something like this:
typealias JSON = [String: AnyObject]
struct User {
let id: Int
let name: String
}
let userValidator = JSONValidator<User> { (json) -> Bool in
if let
_ = json["id"] as? Int,
_ = json["firstname"] as? String
{
return true
}
return false
}
struct UserParser: JSONParserType {
func parseJSON(json: JSON) -> User {
let user = User(
id: json["id"] as! Int,
name: json["firstname"] as! String
)
return user
}
}
if let users = parse(json, userValidator, UserParser()) {
// Stuff..
}
Do you think it is better to join the parser and validator to avoid force unwrapping?
Would be nice to have a single "redirect file" for the old style (non/blog/
) URLs.
Could maybe do this via .htaccess
or something?
Instead of using custom google search, do something like this?
https://ashfurrow.com/blog/static-site-search-with-middleman-and-lunrjs/
Depends on #48
Hello Jesse,
I'm Jie Liang, you can call me Jie if you like.
Last year I organized a group of people to translate Apple's The Swift Programming Language into Chinese, in order to help many Chinese developers who cannot read english learn Swift. If you want to learn more please read this. Apple has added our translation into swift.org.
You know Chinese developers cannot access many websites(like twitter) and many of them cannot read english. So I found a non-profit translate group to help them.
Our group have 20+ people. All of us are iOS developers and we want to translate articles and publish them for free(http://swift.gg). All of our translations have gain the authorization from author. Our goal is helping Chinese iOS developers learn Swift well.
I found your Open Source Swift series really helpful, but I don't want infringement(while many others do). So I write this email to see whether you can authorize us.
We really want to do some useful things for others. We love Swift and we love coding.
We promise:
Would you like to help us?
Thanks.
Like Lee Morgan and its AutoAssets you mentioned in your article, others developed tools to generate constants automatically, which could be worth mentioning as well
add keep_files:
to _config.yml
for well-known
directory (and others?)
_include/
to reduce copy-pasta?A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.