Comments (5)
Good idea. My very rough attempt at defining a rule:
When a line of code wraps beyond a printed line, break the line at the next syntax appropriate spot. The new line(s) should be indented with two spaces after the previous line. Example:
_productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
In print this line would wrap, so should be reformatted to:
_productsRequest = [[SKProductsRequest alloc]
initWithProductIdentifiers:productIdentifiers];
This might not be the best guideline, so I'm open to discussion here.
from objective-c-style-guide.
In the previous version of the iOS Apprentice, when a line was wrapped it had a special character inserted at the end that indicated this (a little arrow). That might be worth looking into.
For the current version, which is done in Word, when I wrap a line I shift it over all the way to the right so that it is obvious that it is wrapped. Not ideal but I find that clearer than simply indenting it.
(Choosing a slightly smaller font for code blocks will also help prevent wrapping.)
Sent from my iPhone
On 12 nov. 2013, at 20:11, rwenderlich [email protected] wrote:
Good idea. My very rough attempt at defining a rule:
When a line of code wraps beyond a printed line, break the line at the next syntax appropriate spot. The new line(s) should be indented with two spaces after the previous line. Example:
_productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
In print this line would wrap, so should be reformatted to:_productsRequest = [[SKProductsRequest alloc]
initWithProductIdentifiers:productIdentifiers];
This might not be the best guideline, so I'm open to discussion here.—
Reply to this email directly or view it on GitHub.
from objective-c-style-guide.
I've seen the arrow used in other books too. It is very difficult to cut and paste when viewing the electronic versions.
from objective-c-style-guide.
Putting special characters at the end of a line when it wraps is a maintenance nightmare, I'd vote against that until we have better tooling support to do that automatically :]
A smaller font for code blocks is a good idea and something we should do for future books for sure though.
from objective-c-style-guide.
Agree on this.
Cesare Rocchi
studiomagnolia.com
On Nov 17, 2013, at 6:17 PM, rwenderlich [email protected] wrote:
Putting special characters at the end of a line when it wraps is a maintenance nightmare, I'd vote against that until we have better tooling support to do that automatically :]
A smaller font for code blocks is a good idea and something we should do for future books for sure though.
—
Reply to this email directly or view it on GitHub.
from objective-c-style-guide.
Related Issues (20)
- Init section contradicts Golden path section HOT 2
- Can we lint to enforce some of this style guide? HOT 6
- Symbol prefix: 2 vs. 3 characters HOT 26
- English should be used, really? HOT 7
- What's the point on using properties instead of instance variables? HOT 8
- Direct access to properties. HOT 5
- License for this guide? HOT 1
- Not linking to Official Apple Style Guide HOT 1
- RWT prefix typo in constant definition HOT 1
- What is the recommended line width for Objective-C?
- Use style guide principles in examples
- arrayCount should be named something else HOT 4
- Contradiction between Init Methods and Golden Path
- Error handling
- I want make new branch for Korean ver.
- Google style guide URL is broken HOT 2
- Should self keyword should be used in init methods ?
- How do I indent something like this??? HOT 3
- Xcode behavior regarding indenting block
- 关于枚举(Enumerated Types)的想法
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from objective-c-style-guide.